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 meghana <me...@amultek.com> on 2011/12/21 15:39:58 UTC

Solr - Mutivalue field search on different elements

Hi all,

i need to make a different search on multivalued field. 
for e.g. i have data as below
<arr name="xx">
  <str>Michel</str>
  <str>Jackson</str>
  <str>is</str>
  <str>good</str>
   <str>singer and dancer</str>
</arr>

if i search using "Michel Jackson" , then i want above displayed record
should come in result (search word in  in consecutive  element). 

do anybody have any idea?
Thanks
Meghana

--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-Mutivalue-field-search-on-different-elements-tp3604213p3604213.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr - Mutivalue field search on different elements

Posted by meghana <me...@amultek.com>.
Hi iorixxx,

Sorry for confusion in my question...

yes , "1s", "3s", "4s" are part of my field value.. i have my data in this
format. and the field is non-multivalued field (single valued). 

so as PositionIncrementGap is only work for multivalued field ,  in my
search i always have to apply slop in my search.  

Thanks for reply.
Meghana. 



--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-Mutivalue-field-search-on-different-elements-tp3604213p3614365.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr - Mutivalue field search on different elements

Posted by Gora Mohanty <go...@mimirtech.com>.
On Tue, Dec 27, 2011 at 6:11 PM, meghana <me...@amultek.com> wrote:
> Hi iorixxx,
>
> I have changed my multiValued field to single value filed.. and now my field
> appears as below
> -------------------------------------
> 1s: This is very nice day. 3s: Christmas is about come and christmas
> 4s:preparation is just on
> -------------------------------------

Your question is not very clear. What is meant by the above: Is this
the value of the single-valued field in one document in your index?
What is "1s", "3s", "4s" above? Are they part of the field value?

> but by doing this, i don't get my search : "christmas preparation" to be
> matched on my search query , although i had set my positionIncrementGap to
> 0.  any ideas why it is not matching ??

positionIncrementGap has no effect on a single-valued field.

It might be easier if you explained what you are trying to achieve.

Regards,
Gora

Re: Solr - Mutivalue field search on different elements

Posted by meghana <me...@amultek.com>.
Hi Kogi , 
Thanks for reply. 

I tried by adding BoundaryScanner in my solrconfig.xml  and set
hl.useFastVectorHighlighter=true, termVectors=on, termPositions=on and
termOffsets=on. in my query. then also i didn't get any effect on my
highlighting. 

my solr config setting is as below
<boundaryScanner name="default"
                        default="true"
                        class="solr.highlight.SimpleBoundaryScanner">
        <lst name="defaults">
           <str name="hl.bs.maxScan">10</str>
           <str name="hl.bs.chars">s:</str>
         </lst>
       </boundaryScanner>

do i missing anything , or doing anything wrong?? 
i like to make a note that i am using solr version 1.4

Thanks
Meghana

--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-Mutivalue-field-search-on-different-elements-tp3604213p3615937.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr - Mutivalue field search on different elements

Posted by Ahmet Arslan <io...@yahoo.com>.
> i can't delete 1s ,2s ...etc from my
> field value , i have to keep text in
> this format... so i'll apply slop in my search to do my
> needed search done.

It is OK if you cant delete 1s, 2s, .... etc from field value. We can eat up those special markups in analysis chain. PatternReplaceCharFilterFactory
or PatternReplaceFilterFactory should do the trick.

http://lucene.apache.org/solr/api/org/apache/solr/analysis/PatternReplaceCharFilterFactory.html

http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.PatternReplaceFilterFactory

Re: Solr - Mutivalue field search on different elements

Posted by meghana <me...@amultek.com>.
i can't delete 1s ,2s ...etc from my field value , i have to keep text in
this format... so i'll apply slop in my search to do my needed search done.

--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-Mutivalue-field-search-on-different-elements-tp3604213p3615816.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr - Mutivalue field search on different elements

Posted by Ahmet Arslan <io...@yahoo.com>.
> I have changed my multiValued field to single value filed..
> and now my field
> appears as below
> -------------------------------------
> 1s: This is very nice day. 3s: Christmas is about come and
> christmas
> 4s:preparation is just on
> -------------------------------------
> but by doing this, i don't get my search : "christmas
> preparation" to be
> matched on my search query , although i had set my
> positionIncrementGap to
> 0.  any ideas why it is not matching ?? 

So you concatenated your sentences. If you could delete 1s, 2s, .. 4s too, both search with phrase and highlighting will work.

At the end, your field value would be : 
-------------------------------------
This is very nice day. Christmas is about come and christmas preparation is just on
-------------------------------------

Re: Solr - Mutivalue field search on different elements

Posted by meghana <me...@amultek.com>.
Hi iorixxx,

I have changed my multiValued field to single value filed.. and now my field
appears as below
-------------------------------------
1s: This is very nice day. 3s: Christmas is about come and christmas
4s:preparation is just on
-------------------------------------
but by doing this, i don't get my search : "christmas preparation" to be
matched on my search query , although i had set my positionIncrementGap to
0.  any ideas why it is not matching ?? 

Please help me.
Meghana

--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-Mutivalue-field-search-on-different-elements-tp3604213p3614313.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr - Mutivalue field search on different elements

Posted by Ahmet Arslan <io...@yahoo.com>.
> setting positionIncrementGap is worked for me and it
> allowing me to search
> in 2 diff. consecutive elements. 
> But as i explained before , i also want to display
> highlighting for which
> term / phrase search is made. 
> 
> So when we search with phrase and make highlighting on , it
> is not returning
> me highlighting on that phrase. Is there any solution to
> that ?

I would create an additional field which is populated by concatenation of that multivalued field's elements. 


Re: Solr - Mutivalue field search on different elements

Posted by meghana <me...@amultek.com>.
Hi all ,

setting positionIncrementGap is worked for me and it allowing me to search
in 2 diff. consecutive elements. 
But as i explained before , i also want to display highlighting for which
term / phrase search is made. 

So when we search with phrase and make highlighting on , it is not returning
me highlighting on that phrase. Is there any solution to that ?

Thanks
Meghana

--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-Mutivalue-field-search-on-different-elements-tp3604213p3608892.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr - Mutivalue field search on different elements

Posted by meghana <me...@amultek.com>.
Thanks Erik . i seen that , how it work with slop after making few operations
:) . 

so i am happy with this now. but still i have one issue , when i do search i
also need to show highlighting on that field, setting positionIncrementGap
to 0, and then when i make phrase search . it does not return me
highlighting on that words of phrase. can i handle this by doing some
configuration changes?

Thanks 
Meghana



--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-Mutivalue-field-search-on-different-elements-tp3604213p3606597.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr - Mutivalue field search on different elements

Posted by Erick Erickson <er...@gmail.com>.
positionIncrementGap is only really relevant for phrase searches. For
non-phrase searches you can effectively ignore it.

The problem here is what you mean by "consecutive element". In your
original example, if you mean that searching for "michael singer" should
NOT match, then you want to use phrase searches with a positionIncrementGap
as Tanguy says and no slop.

Maybe this will help. The purpose of setting positionIncrementGap to non-zero
is to do the opposite of what you want. Say each entry in a multiValued field
is a sentence and you do NOT want a search that contains words in two
different sentences to match. Say further that your sentences will never be
longer than 100 words. Setting positionIncrementGap to 100 and using
phrases for all your searches like this "word search"~100 would guarantee
that no match would occur for a document in which one sentence contained
"word" and another sentence contained "search", but documents *would*
match where single sentence contained both words.

Best
Erick

On Thu, Dec 22, 2011 at 1:17 AM, meghana <me...@amultek.com> wrote:
> Hi Tanguy,
>
> Thanks for your reply.. this is really useful. but i have one questions on
> that.
>
> my multivalued field is not just simple text. it has values like below
>    <str>1s:[This is very nice day.]</str>
>    <str>3s:[Christmas is about come and christmas]</str>
>    <str>4s:[preparation is just on ]</str>
> now i if i search with "christmas preparation" , then this should match. if
> i set positionIncrementGap to 0 then do it will match? Or how value of
> positionIncrementGap behave on my search?
>
> Meghana
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Solr-Mutivalue-field-search-on-different-elements-tp3604213p3605938.html
> Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr - Mutivalue field search on different elements

Posted by meghana <me...@amultek.com>.
Hi Tanguy,

Thanks for your reply.. this is really useful. but i have one questions on
that.

my multivalued field is not just simple text. it has values like below
    <str>1s:[This is very nice day.]</str>
    <str>3s:[Christmas is about come and christmas]</str>
    <str>4s:[preparation is just on ]</str>
now i if i search with "christmas preparation" , then this should match. if
i set positionIncrementGap to 0 then do it will match? Or how value of
positionIncrementGap behave on my search?

Meghana

--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-Mutivalue-field-search-on-different-elements-tp3604213p3605938.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr - Mutivalue field search on different elements

Posted by Tanguy Moal <ta...@gmail.com>.
Hello,

I think that the positionIncrementGap  attribute of your field has to 
changed to 0 (instead of 100 by default).

(See 
http://lucene.472066.n3.nabble.com/positionIncrementGap-in-schema-xml-td488338.html 
)

Hope this helps,

--
Tanguy

Le 21/12/2011 15:39, meghana a écrit :
> Hi all,
>
> i need to make a different search on multivalued field.
> for e.g. i have data as below
> <arr name="xx">
>    <str>Michel</str>
>    <str>Jackson</str>
>    <str>is</str>
>    <str>good</str>
>     <str>singer and dancer</str>
> </arr>
>
> if i search using "Michel Jackson" , then i want above displayed record
> should come in result (search word in  in consecutive  element).
>
> do anybody have any idea?
> Thanks
> Meghana
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Solr-Mutivalue-field-search-on-different-elements-tp3604213p3604213.html
> Sent from the Solr - User mailing list archive at Nabble.com.