full-text-search

Full-text Search on Joined, Hierarchical Records in SQL Server 2008

纵饮孤独 提交于 2019-12-11 04:49:17
问题 Probably a noob question, but I'll go for it nevertheless. For sake of example, I have a Person table, a Tag table and a ContactMethod table. A Person will have multiple Tag records and multiple ContactMethod records associated with them. I'd like to have a forgiving search which will search among several fields from each table. So I can find a person by their email (via ContactMethod), their name (via Person) or a tag assigned to them. As a complete noob to FTS, two approaches come to mind:

Improve ranking times on multiple JSONB fields search in PostgreSQL

a 夏天 提交于 2019-12-11 04:45:46
问题 My search times are actually quite fast now but as soon as I start to rank them for the best results I hit a wall. The more hits I get, the slower it gets. For uncommon terms the search takes ~2ms and for more common ones it's ~900ms+. In the example I have gathered all possible structures within my data (simple, arrays, nested arrays). CREATE TABLE book ( id BIGSERIAL NOT NULL, data JSONB NOT NULL ); Then I build a function which concatenate the name values of my nested array field 'author':

How to identify the matching field(s) for MongoDB text search?

↘锁芯ラ 提交于 2019-12-11 04:31:22
问题 I set up a compound text index on two fields on my collection. I want to perform a text search on these two fields. Testing it out with the following command gave me satisfactory results. db.collection.find({$text: {$search: "term"}}, {score: {$meta: "textScore"}}).sort({score:{$meta:"textScore"}}) However, I would like to know along with each result which of the two indexed fields matched the search term. Is this possible? It seems so incredibly basic and I can't find support for this

Sphinx ignores ranking, always sorts in the same order

人走茶凉 提交于 2019-12-11 04:21:25
问题 I have sphinx index on schools , and when I do a query I always receive the same results, in the same order. I've tried every imaginable combination of ranking, sorting, and matching, and always get the same sorting. A sample of the bad data I'm getting is below: "albany high" Albany Junior High School | Auckland, NZ | 2001 (shouldn't be first) Albany High School | Albany, NY | 2001 South Albany High School | Albany, OR | 2001 Albany High School | Albany, CA | 1001 (shouldn't be last) As you

I dont' understand with “not” in full text search

我与影子孤独终老i 提交于 2019-12-11 04:14:38
问题 I don't understand why I'm getting these results with my full-text search query in SQL Server 2014. The following query returns results with "Supervisor" in the Title field and "Tokyo" in the HTML_Description field. SELECT * FROM post JOIN CONTAINSTABLE([post], (Title, HTML_Description), 'Supervisor AND NOT Tokyo') AS tb1 ON tb1.[Key] = post.ID If I remove the HTML_Description field in the CONTAINSTABLE like this: SELECT * FROM post JOIN CONTAINSTABLE(post, (Title), 'Supervisor AND NOT Tokyo'

Ranking or position of a solr document in search results

两盒软妹~` 提交于 2019-12-11 04:09:43
问题 I need to list the ranking (or position, as you might prefer) or each document after a query in solr. the thing i wanna see is something like this: <doc> <int name="field1">1</int> <str name="someotherfield">blabla</str> <int name="position">1</int> </doc> <doc> <int name="field1">2</int> <str name="someotherfield">blabla</str> <int name="position">2</int> </doc> <doc> <int name="field1">3</int> <str name="someotherfield">blabla</str> <int name="position">3</int> </doc> is this possible? or i

Postgresql full text search for similar words

怎甘沉沦 提交于 2019-12-11 04:06:25
问题 Trying to implement postgresql full text search example by following these steps; I have created a table: CREATE TABLE posts ( id serial primary key, content varchar(255), tags varchar(255), title varchar(255) ); Altered the table to have a column of type TSVECTOR ALTER TABLE posts ADD COLUMN searchtext TSVECTOR; Created a trigger to store data in searchtext column: CREATE TRIGGER ts_searchtext BEFORE INSERT OR UPDATE ON posts FOR EACH ROW EXECUTE PROCEDURE tsvector_update_trigger('searchtext

How to escape string for SQLite FTS query

試著忘記壹切 提交于 2019-12-11 03:53:40
问题 I'm trying to perform a SQLite FTS query with untrusted user input. I do not want to give the user access to the query syntax, that is they will not be able to perform a match query like foo OR bar AND cats . If they tried to query with that string I would want to interpret it as something more like foo \OR bar \AND cats . There doesn't seem to be anything built in to SQLite for this, so I'll probably end up building my own escaping function, but this seems dangerous and error-prone. Is there

How to detect if a file is not a text file in c#

筅森魡賤 提交于 2019-12-11 03:39:39
问题 I need to read through many files and search for specific text in them. I want to open only text files, i.e., no image, movie, etc. files. I am looking for a way to identify non-text files. Since I will be using a FileStream and doing a byte search, it seems to me I can stop reading and close a file if a byte whose decimal value is greater than 128 is encountered. Does this seem like a good approach? 回答1: There's no foolproof answer for this. If you know that any text files will only ever be

Extended characters (european) to US ascii for search indexing

独自空忆成欢 提交于 2019-12-11 03:34:54
问题 I'm looking for a table or heuristic library that can convert extended characters like the o with the hat above it to a regular ascii o. I'm looking to do this for search indexing purposes since most people are not going to type the o with the hat. For example I type "Cote" into the search but I want my search to include things like "Côte". It appears Solr does not convert these. I tried java.text.Normalizer and friends but that did not work. did work see solution below. 回答1: You want to use