is there 'indexed but not stored' field in sphinx? - sphinx

I'm trying to found a field defination like Solr's 'indexed but not stored'. http://sphinxsearch.com/wiki/doku.php?id=fields_and_attributes, by the document, sphinx has not defined such field. Is there anyway to reach this?

Fields ARE "indexed but not stored". They are the staple of full-text searching. A column is automatically a field unless made an attribute.
Attributes on the other hand, are stored - but not 'indexed' as such.

Related

MongoDB. Searching substring in string field

Currently, I have a MongoDB instance, which contains a collection with a lot of entities. Each entity contains a string attribute, which represents some text. My goal is to provide a strict text search in the collection. It should work as a MySQL query:
SELECT *
FROM texts
WHERE text LIKE '%test%';
MongoDB text index would be great, but it doesn't provide a strict search. How I could organize a strict search for such data? Could I do some optimization?
I already checked other software (such as ElasticSearch, Lucene, MongoDB, ClickHouse), but I haven't found options to do it. Searching as now took too much time.
In mongoDB you can do it as follow:
db.texts.find({ text:/test/ })

Is there a way to customize stemming process in mongodb full text search?

I have a word "CenturyLink" which I want to force mongodb to stem to "Centuri" so that when I search for "Century" ,which stems to "Centuri", all the documents with "CenturyLink" are also returned.
So basically I want to add some custom set of key values of "word and it's stem" so that fts indexing is done on the basis of the provided key values.
Is this possible?

MongoDB: Update all fields

Is there a way I can update every field in a MongoDB document without just listing all the fields, which might change later? Something like this?
db.update(
{foo:"bar"},
{$unset: {{}:""}}
)
Consider the cogency of an operation like this. How are you updating all of the fields meaningfully without considering their specific types or values? It looks like you are trying to unset the fields or set them to a default, null-like value. What does it mean to unset every field in a document? Isn't it really just removing the document? Are you excluding _id and other immutable fields (shard key!) somehow? What is the default value for the possible field types? What is the default value for a field that can be an integer or an array of integers in a data model? It's also dangerous to try to do something like this, especially with flexible schemas. Needing to do the above operation indicates a good chance that you need to rethink your data model.

Searching a value in a specific field in MongoDB Full Text Search

(MongoDB Full Text Search)
Hello,
I have put some fields in index and this is how I could search for a search_keyword.
BasicDBObject search = new BasicDBObject("$search", "search_keyword");
BasicDBObject textSearch = new BasicDBObject("$text", search);
DBCursor cursor = users.find(textSearch);
I don't want search_keyword to be searched in all the fields specified in the index. *Is there any method to specify search_keyword to be searched in specific fields from the index??*
If so, please give me some idea how to do it in Java.
Thank you.
If you want to index a single field and search for it then it is the way it works by default. Lets say you want to index the field companyName. When you perform $text search on this collection, only the data from the companyName field will be used because you only included that field in your index.
Now the second scenario, your $text index includes more than one field. In this case you cannot limit the search to only look for values indexed from a specific field. The $text index is constructed on the collection level and a collection can have at most one $text index. Your option to limit search on specific field in this case may be to use regex instead.
MongoDB has the flexibility to fulfil requirements of other scenarios, but you can also evaluate using other technologies if your application is heavily search-driven and you are primarily after a full-text search engine for locating documents by keyword with a rich query syntax. ElasticSearch might be an alternative here. It really depends on the type of the application and your needs.

Indexing and searching number field in mongodb

I have created the following collection and text index:
db.test1.insert({"name":"kumar goyal","email":'rakesh.goyal#gmail.com',"phoneNo":9742140651});
db.test1.ensureIndex({ "$**": "text" },{ name: "TextIndex" })
Partial search is working for name and email field e.g.
db.test1.runCommand("text",{search:'rakesh'});
returns the record properly but its not working on the phoneNo field.
db.test1.runCommand("text",{search:'9742'});
is not working.
I guess text index is not working on number fields. Is there anyway to make it work in mongodb?
You are inserting the telephone number as a number, but then searching for it as a string.
Perhaps you should consider inserting the telephone number as a string. You're not planning to perform any arithmetic actions on that field are you?
This way mongo will be able to perform textual searches (like the one you gave as an example) on the "numbers" but will treat them as strings.
Mongo DB full text does not support partial search. Hence it was not working, nothing to do with numbers.