Home » Php » php – MongoDb Full text search eats memory when i search on com and other small words

php – MongoDb Full text search eats memory when i search on com and other small words

Posted by: admin February 25, 2020 Leave a comment

Questions:

Thank you for reading this, i have an collection with full text th index size is of the index is 809.7MB (Mongo Compass) but when i search for com or other small words the memory is full (8GB memory).

Its a sharding.

Does anyone know why this is?

How to&Answers:

what are your indexes? small words sounds like they are not the first, left most characters of the field…you have a wild card in front of the word?…if so it is a very inefficient search…

Answer:

if I understand; your text search then must touch every document.

perhaps you have no alternative but the way to do a faster query is to:
a. match to the index
b. text search on the beginning letters i.e. ^ symbol as search the first letters is much more efficient than searching anywhere in the string…

if this is not possible, and text searching is going to be a major component of your application you would consider some strategies:
* create key search words as part of the data input that can be used by the text query process
* delimit the pool of possible docs in some way perhaps a date range, topic, etc – – ultimately you probably would want to index on these and include them in your text query.