Answer the question
In order to leave comments, you need to log in
How to format search results?
Good afternoon. I use to search for sphinx. I get an array with search results as an output.
What is the best way to format the received results for their issuance to the end user?
Let me give you an example of what I mean.
Search for: "Regulations of the department"
In the search results there are articles of 2-3k characters
"Regulations of department A"
"Regulations of department B"
, etc.
Displaying 2-3k characters for each result and turning the search into mountains of text is not an option. In a stupid cut after n characters is also not suitable.
I would like to somehow beautifully cut pieces of text around the found matches.
Ideally, I submit the found text on the request "Vasya" and at the output of 2-3k I get 50-60 characters like:
"... Lorem ipsum dolor sit amet Vasya, consectetur adipiscing elit ...". Vasya... Nunc vitae tincidunt tortor, eget lobortis velit. Donec viverra, sem at dapibus fringilla
Answer the question
In order to leave comments, you need to log in
sphinxsearch.com/forum/view.html?id=10870 - should suit you
Or cut the search itself after you get it in your backend.
This is all done on the side of the programming language, cut and format as you please
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question