I have implemented the full text search using Sphinx and Thinking Sphinx. I want to add column wise search. Some thing like:-(taking an example of Stack Overflow)
Suppose you want to see actvities related to you, just type:
user:me
Then it will return a result with all the questions and answers related to piemesons.
If you type
votes:15
then it will return a result with all the questions tagged with having more than 15 votes.
And if you type
user:me votes:15
then it will return all the questions and answers belonging to you with more than 15 votes.
How can I implement this thing?
Right now my search results are based upon full text search. How can these kinds of features be included?
Any options avaliable in Sphinx or Solr or any other search engines?
Stack Overflow is a question and answer website for professional and enthusiast programmers. It is the flagship site of the Stack Exchange Network. It was created in 2008 by Jeff Atwood and Joel Spolsky. It features questions and answers on a wide range of topics in computer programming.
If a user wants to search his questions, the user can use this query user: mine or user: me, or in case the user wants to search for another user's questions, he can use the query user: id and this will return all the questions that a specific user has asked.
Teams API: A First Request WalkthroughThe Stack Exchange API permits access to data within private Teams. Only Stack Overflow Business accounts have read and write access to the API.
A stack overflow is a type of buffer overflow error that occurs when a computer program tries to use more memory space in the call stack than has been allocated to that stack.
:with
option in thinking sphinx.
First of all, you have to define those attributes in your index definition (check out attributes section here).
has views_count, :as => :views, :type => :integer
has user.id, :as => :user, :type => :integer
Then you could search for posts like this:
Post.search '', :with => {:views => 12..maxint, :user => User.first.id}
(I am not sure if there is any more elegant possibility of giving open ranges, but 12..max_int should be enough)
Two important things:
"CRC32(CONCAT(user_type, user_id))"
instead of user.id
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With