Hi, Erick!

And thank you for answering! You always answer my questions, :-) Well, I´ll
try to explain better, because the context is more complex. The original
problem becomes from MoreLikeThis behaviour. As you probably know that Solr
feature only suggests similar components by the first - and only - document
returned from the original query. That is if you have a query that returns
5 documents (a query with five IDs with OR boolean clauses, like before)
MoreLikeThis only returns similar documents for the first one.

Thats very frustrating, and I tried to solve it partially - and not very
efficiently. I´ve got an intermediate business logic that manages querys
from the front-end and Solr architecture. This components defines and API
of queries and pre and post processors to execute with it. The thing is
that I want to return similar documents for, for example, five documents
queried. Due to MoreLikeThis limitations I do this:

1. First MoreLikeThis query for the first document. I get all the similar
documents.
2. Second MoreLikeThis query for the second document. I get all the similar
documents.
  ...
5. Fith MoreLikeThis query for the fith document. I get all the similar
documents.

I have to notice that the order of the query is important. I mean that the
first ID is the first ID because its more important that the second ID,
etc. So now I have to merge the results but, hey! Imagine that you receive
a sort by Date. You have to compose the final response with the merged
similar documents and sort it by Date. Thats a problem, right? So I do the
following:

1. Get first similar document ID from the first ID response.
2. Get the first similar document ID  from the second ID response.
  ...
3. Get the first similar document ID  from the fith ID response.
4. Get the second similar document ID  from the first ID response.
  ....
N. Get the N similar document ID  from the fith ID response.


The number of documents is not important. Imagine that you have a rows=20,
so N=20 and you have and array of 20 similar components ordered correctly
from most important to less important. Returning to the sorting problem, if
you launch another and final query to Solr with q=(all the similar document
IDs ordered) you can append the original sorting by Date, so the results
can be sorted by Date, or by other field, or just without order... and
that´s the problem!

If you don´t indicate any order I hope that the documents will be returned
with the similar documents IDs sorting: I mean from most important to less
important, and you saw what Solr does: returns the documents response with
score sort.

Phew! And that´s all. Ehm... any suggestion? :-D Hehehe.

Thank you so much!



Luis Cappa.

Reply via email to