You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by kumar <pa...@gmail.com> on 2013/10/21 15:24:11 UTC

Exact Match Results

I am querying solr for exact match results. But it is showing some other
results also.

Examle :

User Query String : 

Okkadu telugu movie

Results :

1.Okkadu telugu movie
2.Okkadunnadu telugu movie
3.YuganikiOkkadu telugu movie
4.Okkadu telugu movie stills


how can we order these results that 4th result has to come second.


Please anyone can you give me any idea?



--
View this message in context: http://lucene.472066.n3.nabble.com/Exact-Match-Results-tp4096816.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Exact Match Results

Posted by Erick Erickson <er...@gmail.com>.
admin/analysis is your friend here. It'll tell you exactly what gets into
your
index and the transformations defined by each step along the way.

As "Developer" pointed out, you're using the ngram filter, that's almost
surely
what's causing the matches you're seeing.

FWIW,
Erick


On Tue, Oct 22, 2013 at 2:04 AM, Developer <bb...@gmail.com> wrote:

> For exact phrase match you can wrap the query inside quotes but this will
> perform the exact match and it wont match other results.
>
> The below query will match only : Okkadu telugu movie stills
>
>
> http://localhost:8983/solr/core1/select?q=%22okkadu%20telugu%20movie%20stills%22
>
> Since you are using Edge N Gram filter, it produces so many tokens (as
> below). You might not get the desired output. You can try using shingle
> factory with standard analyzer instead of using edge n gram filter.
>
> o
> [6f]
> 0
> 26
> 1
> 1
> word
>
> ok
> [6f 6b]
> 0
> 26
> 1
> 1
> word
>
> okk
> [6f 6b 6b]
> 0
> 26
> 1
> 1
> word
>
> okka
> [6f 6b 6b 61]
> 0
> 26
> 1
> 1
> word
>
> okkad
> [6f 6b 6b 61 64]
> 0
> 26
> 1
> 1
> word
>
> okkadu
> [6f 6b 6b 61 64 75]
> 0
> 26
> 1
> 1
> word
>
> okkadu
> [6f 6b 6b 61 64 75 20]
> 0
> 26
> 1
> 1
> word
>
> okkadu t
> [6f 6b 6b 61 64 75 20 74]
> 0
> 26
> 1
> 1
> word
>
> okkadu te
> [6f 6b 6b 61 64 75 20 74 65]
> 0
> 26
> 1
> 1
> word
>
> okkadu tel
> [6f 6b 6b 61 64 75 20 74 65 6c]
> 0
> 26
> 1
> 1
> word
>
>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Exact-Match-Results-tp4096816p4096906.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: Exact Match Results

Posted by Developer <bb...@gmail.com>.
For exact phrase match you can wrap the query inside quotes but this will
perform the exact match and it wont match other results.

The below query will match only : Okkadu telugu movie stills

http://localhost:8983/solr/core1/select?q=%22okkadu%20telugu%20movie%20stills%22

Since you are using Edge N Gram filter, it produces so many tokens (as
below). You might not get the desired output. You can try using shingle
factory with standard analyzer instead of using edge n gram filter.

o
[6f]
0
26
1
1
word
	
ok
[6f 6b]
0
26
1
1
word
	
okk
[6f 6b 6b]
0
26
1
1
word
	
okka
[6f 6b 6b 61]
0
26
1
1
word
	
okkad
[6f 6b 6b 61 64]
0
26
1
1
word
	
okkadu
[6f 6b 6b 61 64 75]
0
26
1
1
word
	
okkadu
[6f 6b 6b 61 64 75 20]
0
26
1
1
word
	
okkadu t
[6f 6b 6b 61 64 75 20 74]
0
26
1
1
word
	
okkadu te
[6f 6b 6b 61 64 75 20 74 65]
0
26
1
1
word
	
okkadu tel
[6f 6b 6b 61 64 75 20 74 65 6c]
0
26
1
1
word
	




--
View this message in context: http://lucene.472066.n3.nabble.com/Exact-Match-Results-tp4096816p4096906.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Exact Match Results

Posted by kumar <pa...@gmail.com>.
Hi i am using field type configuration in the following way.....

<field name="fsw_title" type="text_full_startwith_match" indexed="true"
stored="false" multiValued="true" omitNorms="true"
omitTermFreqAndPositions="true" />


<fieldType name="text_full_startwith_match" class="solr.TextField">
      <analyzer type="index">
      <charFilter class="solr.MappingCharFilterFactory"
mapping="mapping-ISOLatin1Accent.txt"/>
      <tokenizer class="solr.KeywordTokenizerFactory"/>
      <filter class="solr.LowerCaseFilterFactory"/>
      <filter class="solr.PatternReplaceFilterFactory" pattern="([\.,;:-_])"
replacement=" " replace="all"/>
      <filter class="solr.EdgeNGramFilterFactory" maxGramSize="30"
minGramSize="1"/>
      <filter class="solr.PatternReplaceFilterFactory"
pattern="([^\w\d\*æøåÆØÅ ])" replacement="" replace="all"/>
      <filter class="solr.StopFilterFactory" ignoreCase="true"
words="stopwords.txt" enablePositionIncrements="true" />
       </analyzer>

       <analyzer type="query">
       <charFilter class="solr.MappingCharFilterFactory"
mapping="mapping-ISOLatin1Accent.txt"/>
       <tokenizer class="solr.KeywordTokenizerFactory"/>
       <filter class="solr.LowerCaseFilterFactory"/>
       <filter class="solr.PatternReplaceFilterFactory"
pattern="([\.,;:-_])" replacement=" " replace="all"/>
       <filter class="solr.PatternReplaceFilterFactory"
pattern="([^\w\d\*æøåÆØÅ ])" replacement="" replace="all"/>
       <filter class="solr.PatternReplaceFilterFactory"
pattern="^(.{30})(.*)?" replacement="$1" replace="all"/>
        <filter class="solr.SynonymFilterFactory" ignoreCase="true"
synonyms="synonyms_fsw.txt" expand="true" />
         <filter class="solr.StopFilterFactory" ignoreCase="true"
words="stopwords.txt" enablePositionIncrements="true" />
         <filter class="solr.KeywordMarkerFilterFactory"
protected="protwords.txt" />
          <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
                 </analyzer>
 </fieldType>




--
View this message in context: http://lucene.472066.n3.nabble.com/Exact-Match-Results-tp4096816p4096847.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Exact Match Results

Posted by Developer <bb...@gmail.com>.
You need to provide us with the fieldtype information..

If you just want to match the phrase entered by user, you can use
KeywordTokenizerFactory..

Reference:
http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters

Creates org.apache.lucene.analysis.core.KeywordTokenizer.

Treats the entire field as a single token, regardless of its content.

Example: "http://example.com/I-am+example?Text=-Hello" ==>
"http://example.com/I-am+example?Text=-Hello"



--
View this message in context: http://lucene.472066.n3.nabble.com/Exact-Match-Results-tp4096816p4096846.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Exact Match Results

Posted by François Schiettecatte <fs...@gmail.com>.
Kumar

You might want to look into the 'pf' parameter:

	https://cwiki.apache.org/confluence/display/solr/The+Extended+DisMax+Query+Parser

François

On Oct 21, 2013, at 9:24 AM, kumar <pa...@gmail.com> wrote:

> I am querying solr for exact match results. But it is showing some other
> results also.
> 
> Examle :
> 
> User Query String : 
> 
> Okkadu telugu movie
> 
> Results :
> 
> 1.Okkadu telugu movie
> 2.Okkadunnadu telugu movie
> 3.YuganikiOkkadu telugu movie
> 4.Okkadu telugu movie stills
> 
> 
> how can we order these results that 4th result has to come second.
> 
> 
> Please anyone can you give me any idea?
> 
> 
> 
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Exact-Match-Results-tp4096816.html
> Sent from the Solr - User mailing list archive at Nabble.com.