lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ahmet Arslan <iori...@yahoo.com>
Subject Re: Query on multivalue field
Date Tue, 01 Mar 2011 22:01:44 GMT
> In a multiValued field, call it field1, if I have two
> values indexed to 
> this field, say value 1 = "some text...termA...more text"
> and value 2 = 
> "some text...termB...more text" and do a search such as
> field1:(termA termB)
> (where <solrQueryParser defaultOperator="AND"/>) I'm
> getting a hit 
> returned even though both terms don't occur within a single
> value in the 
> multiValued field.
> 
> What I'm wondering is if there is a way of applying the
> query against 
> each value of the field rather than against the field in
> its entirety. 
> The reason being is the number of values I want to store is
> variable and 
> I'd like to avoid the use of dynamic fields or
> restructuring the index 
> if possible.

Your best bet can be using positionIncrementGap and to issue a phrase query (implicit AND)
with the appropriate slop value. 

Ff you have positionIncrementGap="100", you can simulate this with using
&q=field1:"termA termB"~100

http://search-lucene.com/m/Hbdvz1og7D71/


      

Mime
View raw message