Thanks Ahmet, Your second suggestion about using the filter query works. Ideally I would like to be able to use the first solution with hl.requireFieldMatch=true, but I cannot seem to get it to work no matter what I do.
I changed the query to just 'smith~' and hl.requireFieldMatch=true and I get results but no highlights.... :( On Tue, Sep 8, 2009 at 12:12 PM, AHMET ARSLAN <iori...@yahoo.com> wrote: > > I currently have highlighting working, but when I search for > > Query: "smith~ category_id:(1 OR 2 OR 3)" > > Results: "name: Mr. John <em>Smith</em>, > > addresses: <em>1</em> Main St, NYC, > > NY, 55<em>2</em>666" > > > Why does it show highlights on the addresses, when I > > specifically sent in a > > query for category_id? When I set > > hl.requireFieldMatch and > > hl.usePhraseHighlighter to true, I get 0 results > > highlighted. > > Althougth hl.usePhraseHighlighter is about PhraseQuery (and SpanQuery) > hl.requireFieldMatch=true should work for your case. > When you set hl.requireFieldMatch to true, do you get result returned? But > without highlighted? If yes I think your default operator is set to OR. > Those results without highlights are coming from category_id:(1 OR 2 OR 3) > part of your query. > Try "smith~ AND category_id:(1 OR 2 OR 3)" or alternatively you can use > filter queries for structured fields (integer, string) like > q=smith~&fq=category_id:(1 OR 2 OR 3) > > Hope this helps. > > > >