Can lucene query be customized to do some processing on computed index field?

Basically, we would like to store user related information, e.g {UserId,LikedDate} in computed index field(here, the computed index field contains multiple user like information in “|” separated format. e.g 1234,20180407|4567,20180214). We can fetch the document using UserId but we also wanted to sort the document base on LikedDate in descending order including pagination. It looks very complex to achieve. But still wanted to explore the possibilities.

Can anyone suggest any possible solution or other better options?

  • 1
    You're missing the point of using an index. Why not separate them into multiple fields instead of one field?
    – TamerM
    Mar 19, 2018 at 7:58
  • There is one to many relationships here(single item can be liked by multiple users and we want to filter the liked items of single user). Mar 19, 2018 at 12:40
  • I think this kind of data should not be stored in search index, I would use a separated database. Mar 20, 2018 at 14:13
  • @TamásTárnok - you are correct. We've already stored the likes data in database(I forgot to mentioned it). Basically the facet based search is challenging part. We've achieved it. Please find answer. Thanks you! Mar 23, 2018 at 5:12

1 Answer 1


We can use two technologies(SQL and Lucene Search) to achieve the same. We can query Lucene to get the items from search index and then use sql data to sort the items(Note: Here, we need to consider multiple cases including with and without facet based search).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.