You could convert the ipaddresses into 32bit unsigned integers, which is what they represent. Once indexed you can then perform fast queries.
Once in integer format then performing network searchs for things like "192.168.*" would involve calculating the lowest and highest ipaddress in the range and using it with $gte and $lte queries.
There are a number of libraries in various languages for performing the parsing and conversion to and from integers.
For example the php pear library https://pear.php.net/manual/en/package.networking.net-ipv4.php
I need search for the ip address type of string (like 192.168.0.1) a lot in my text fields. It seems that Mongodb is extremely slow in such operations. If i remove the dots from the original text (192168000001) and search for the new string, I can tell the performance improvement. My theory is the dots causes the ambiguity to the search engine which leads to such slowness.I wonder if there are any solutions other than removing the dot?
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/051bd8cf-a93f-4f3f-9c93-6b6287f6c63d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
In the $search field, specify a string of words that the text operator parses and uses to query the text index. The text operator treats most punctuation in the string as delimiters, except a hyphen - that negates term or an escaped double quotes \" that specifies a phrase.
To match on a phrase, as opposed to individual terms, enclose the phrase in escaped double quotes (\"), as in:
"\"ssl certificate\""
If the $search string includes a phrase and individual terms, text search will only match the documents that include the phrase. More specifically, the search performs a logical AND of the phrase with the individual terms in the search string.