2

I am currently working on a project where we want to rank JSON objects by relevance. The user inputs some keywords and a region. We then pull ~1000 events (things like music shows, art exhibitions, etc.) in that region. We then want to rank all these events according to their relevance to the user (according to the keywords they entered.) We need the actual ranking, not just the order, because we want to use this ranking only as one factor in how we sort.

Events are represented as JSON objects. e.g: {"title":"Art exhibition","venue-name":"Art Gallery","description":"An exhibition of modern paintings and sculptures"}

We have ~1000 of these events we want to rank quikcly (less than 1 second hopefully.)

So what we need is a library/software which will do this ranking. One option which came to mind in Sphinx. Sphinx could work but is not really dedicated for this purpose so might be a bit messy. It seems that Sphinx requires an SQL DB to pull the JSON data from. And we are not even using a DB, we just receive them through the network and store them in memory.

That is not so bad really, but it would be nice if there was some software that could handle a raw stream of JSON.

Additional requirements that we have:

  • Search by keyword or several keywords. In the case of several keywords we want the results to contain any of the keywords, not necessarily all of them.
  • Assign different weights to different fields. So that if a keyword appears in the title field, this is given more weight than if it is appears in the description field.
  • Need to interact with that software from Java
  • Needs to be able to search in arrays as well, so e.g we might have an object {"title":"Art exhbition","tags":["art","museum","paintings"]}. We want the software to also search the tags array. We will not have nested arrays or anythign like that. Just 1 level of arrays.
  • Nice to have: ignores stop-words, stem-formation, corrects typos.`

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.