RussellHarrower
RussellHarrower

Reputation: 6810

Ranking MongoDB search

Ok, this might sound simple but am not sure what to do.

I am running PHP 5.3.x and this is what I want to do. I know the find() command. but I am not sure how to rank the returned JSON.

here is how we store our blog

{
"title":"this is a title";
"body":"this is the body";
"author":"ROB"
"keywords":[{'auto';'music';'fun'}]
"country":"USA"
"dateadded":"07-11-2011";
}

what I want to do is the following order Keyword match 100% - 0% Author if author has talked about this keyword a lot there posts go higher up title search score 1 (Meaning matches what user is searching order that by date newest to oldest

please let me know if this is possible.

Upvotes: 1

Views: 619

Answers (1)

Kevin
Kevin

Reputation: 25269

Mongo is a document store not a search engine. I recommend you look at SOLR to index your documents for search/relevancy and store the documents themselves in mongo. For a blog you can probably forgo mongo and just store everything in SOLR but for large document sets this would be a bad idea.

Upvotes: 2

Related Questions