Could you explain the use-case a bit? Because the very
first response I would have is "why in the world did
product management make this a requirement" and try
to get the requirement changed....

As a user, I'm having a hard time imagining being well
served by getting a document in response to a search that
had no relation to my search, it was just a random doc
selected from the corpus.

All that said, I don't think a single query would do the trick.
You could include a "very special" document with a field
that no other document had with very special text in it. Say
field name "bogusmatch", filled with the text "bogustext"
then, at least the second query would match one and only
one document and would take minimal time. Or you could
tack on to each and every query "OR bogusmatch:bogustext^0.0000001"
(which would really be inexpensive) and filter it out if there
was more than one response. By boosting it really low, it should
always appear at the end of the list which wouldn't be a bad thing.

DisMax might help you here...

But do ask if it is really a requirement or just something nobody's
objected to before bothering IMO...

Best
Erick

On Sat, Sep 11, 2010 at 1:10 PM, Satish Kumar <
satish.kumar.just.d...@gmail.com> wrote:

> Hi,
>
> We have a requirement to show at least one result every time -- i.e., even
> if user entered term is not found in any of the documents. I was hoping
> setting mm to 0 will return results in all cases, but it is not.
>
> For example, if user entered term "alpha" and it is *not* in any of the
> documents in the index, any document in the index can be returned. If term
> "alpha" is in the document set, documents having the term "alpha" only must
> be returned.
>
> My idea so far is to perform a search using user entered term. If there are
> any results, return them. If there are no results, perform another search
> without the query term-- this means doing two searches. Any suggestions on
> implementing this requirement using only one search?
>
>
> Thanks,
> Satish
>

Reply via email to