Thanks for your thought Shawn, I don't think fq will be helpful here.  The
field for which I want to turn TF off is "title", which is actually one of
the primary components of score, so I really need it in qf.  I just don't
want the TF portion of the score for that field only.  I don't want it to
issue phrase queries to that field ever, but if the user quotes something,
it does, and I don't know how to make it stop.  To me it seems potentially
more appropriate to send that to the pf fields, although I can think of a
couple good reasons to put it against qf.  That's fine as long as it
doesn't try to build a phrase query against a no TF no pos field.

Ryan

On Wednesday, April 8, 2015, Shawn Heisey <apa...@elyograg.org> wrote:

> 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:
>
> fq=inStock:true
>
> 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:
>
> fq={!edismax}inStock:true
>
> 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.
>
>
> https://cwiki.apache.org/confluence/display/solr/Common+Query+Parameters#CommonQueryParameters-Thefq%28FilterQuery%29Parameter
>
> Thanks,
> Shawn
>
>

Reply via email to