> b) As i have explained i have result set( documents ) and
> each document
> contains a fields "*ad_text*" (with other fields also) which
> is
> multivalued..storing some tags say "B1, B2, B3" in each. bt
> order of tags
> are different for each doc. say (B1, B2, B3) *for
> doc1*,  B3,B1 B2*, for
> doc2*, B1, B3, B2*, doc3*, B2, B3, B1* for doc4*
> 
> if i search for B1: result should come in following order:
> doc1,doc3,doc2,doc4
> (As B1 is first value in maltivalued result for doc1and
> doc3, and B1 is in
> 2nd value in doc2 while  B1 is at 3rd in doc4  )
> if i search for B2: result should come in following order:
> doc4
> ,doc1,doc3,doc2


I have an idea that could work. Please note that this is untested.

Insert an artificial token at index time. e.g. your multivalued field becomes 
from "B1, B2, B3" to "ARTIFICIALTOKEN, B1, B2, B3"

And fire a query like &q=multivaluedField:"ARTIFICIALTOKEN B2"~1000000^10

Sort by relevancy score (which is the default) should do the trick.

"It may be desirable to boost the score of documents with query terms that 
appear closer together.... Phrase queries with slop will score higher when the 
terms are closer together." 

http://wiki.apache.org/solr/SolrRelevancyCookbook#Term_Proximity

Reply via email to