Ravenight
Posts: 0
Joined: Sun Jan 11, 2015 3:43 pm

MongoDB $text and $search

I would like to make use of $text and $search - which are available as indicated here by Evgene: https://getsatisfaction.com/apperyio/...

How do I ensure I am searching on a text index and how do I create a text index that contains two or more columns?

Is there an example that could be provided that shows how to make this work?

I would like to make this function correctly:
http://docs.mongodb.org/manual/refere...

db.articles.find(
{ $text: { $search: "cake" } },
{ score: { $meta: "textScore" } }
).sort( { score: { $meta: "textScore" } } )

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

MongoDB $text and $search

Hello,

It is better to use where parameter for searching data from two or more culumns:
https://devcenter.appery.io/documenta...

Ravenight
Posts: 0
Joined: Sun Jan 11, 2015 3:43 pm

MongoDB $text and $search

My use case is: records with user entered title (string: s_title), user input in paragraph form (string: s_description) and user created tags (array: a_tags). I need to search across these fields and return the results sorted by relevance.

http://docs.mongodb.org/manual/refere...

This is easily accomplished in the DB with $text and $search. My issue is the creation of the text index I can use to search on.

http://docs.mongodb.org/manual/core/i...

I see in Appery where to manage indexes but nowhere to specify what type of index I am creating.

Please let me know how I can create a single column text index that I can search on.

Multi-column text indexes are supported at the Db level as indicated here:
http://docs.mongodb.org/manual/tutori...

Frank7390035
Posts: 0
Joined: Thu Feb 19, 2015 1:37 am

MongoDB $text and $search

Hello, I also need this function, but it does not work inside a where clause. Is a custom javascript implementation the only option to get this to work?

Thank you,
Frank

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

MongoDB $text and $search

Hello Frank,

Could you clarify what you have tried and what exactly does not work?

Frank7390035
Posts: 0
Joined: Thu Feb 19, 2015 1:37 am

MongoDB $text and $search

Hi Sergiy,

I have entered the following javascript code in data-mapping-before send-where:

{$text: { $search: "cake" } }

My goal is to sort the results by relevance using the command below:

score: { $meta: "textScore" }

I understand that mongodb requires to index columns of the table to be searched as "text". I can't see this option in the Appery db. Can you give suggestions?

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

MongoDB $text and $search

Appery.io doesn't support such requests.
Please look at this link how to use queries: https://docs.appery.io/reference#on-s...
And how to use sorting feature: https://docs.appery.io/reference#sorting

Frank7390035
Posts: 0
Joined: Thu Feb 19, 2015 1:37 am

MongoDB $text and $search

Does Appery allow to programmatically add a "text" index to a mongodb database? I think that with that I might be able to implement a custom javascript service to run such query.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

MongoDB $text and $search

Frank, please clarify, what do you mean with "programmatically add a "text" index to a mongodb database"?

Frank7390035
Posts: 0
Joined: Thu Feb 19, 2015 1:37 am

MongoDB $text and $search

Hi Sergiy,

According to the mondodb manual, a "text index" is needed to use the $text $search fuction*. This is how a text index implemented: https://docs.mongodb.com/manual/core/...

Since Appery uses mongoDB, it is possible to set a text index?, e.g.:

db.reviews.createIndex( { comments: "text" } )

More generally is it possible to operate on the Appery mongodb programmatically rather than just via the interface provided? I have a paid account, would it be possible to work with you so that if it cannot be set programmatically you can set this index it from your back-end?

Thank you,
Frank

*https://docs.mongodb.com/manual/refer...

Return to “Issues”