lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shawn Heisey <>
Subject Re: omitTermFreqAndPositions issue
Date Wed, 08 Apr 2015 23:40:29 GMT
On 4/8/2015 5:06 PM, Ryan Josal wrote:
> The error:
> IllegalStateException: field "foo" indexed without position data; cannot
> run PhraseQuery.
> It would actually be ok for us to index position data but there isn't an
> option for that without term frequencies.  No TF is important for us when
> it comes to searching product titles.
> I should say that only a small fraction of user queries contained quoted
> phrases that trigger this error, so it works much of the time, but we'd
> also like to continue supporting user quoted phrase queries.
> So how can I index a field without TF and use it in edismax qf?

If you omit positions, you can't do phrase queries.  As far as I know,
there is no option in Solr to omit only frequencies and not positions.

I think there is a way that you can achieve what you want, though.  What
you are looking for is filters.  The fq parameter (filter query) will
restrict the result set to only entries that match the query, but will
not affect the relevancy score *at all*.  Here is an example of a filter
query that restricts the results to items that are in stock, assuming
you have the appropriate schema:


Queries specified in fq will default to the lucene query parser, but you
can override that if you need to.  This query would be equivalent to the
previous one, but it would be parsed using edismax:


Here's another example of a useful filter, using yet another query parser:

fq={!terms f=userId}bob,alice,susan

Remember, the reason I have suggested filters is that they do not
influence score.


View raw message