full-text-search

MYSQL FULLTEXT search does not work with hypen '-' and plus '+'

别等时光非礼了梦想. 提交于 2019-12-11 09:55:00
问题 Issue: I am using the MYSQL and PHP latest versions. We are facing the issue in the MYSQL FULLTEXT search. It does not work with the hypen(-) and plus(+) characters. Example:1 In the industry table, 'industry_size' field have the following values: 1. 1 2. 2 - 9 3. 10 - 15 If i am using the search term 2 - 9 , it will show the empty result but the correct answer is 2 - 9 . Example:2 In the user table, 'phone_number' field have the following values: 1. 9856237845 2. +91 8945785698 3. +91

limiting full text mysql searches to exact matches

a 夏天 提交于 2019-12-11 09:47:35
问题 I am trying to match a table with keywords against a text. Problem is, that the query does not return exact matches, but only the most relevant ones: SELECT name, name_safe, MATCH name AGAINST ('".$ad['text']."') as importance FROM $T2 WHERE MATCH name AGAINST ('".$ad['text']."') AND cat_type = 4 ORDER BY importance DESC LIMIT 1 $T2 contains keywords like hunde welpen chihuahua I only want the query to return a hit if it is an exact match. So a search for "welpen" should not return a result.

ILIKE Match Word Boundaries PostgreSQL 9

若如初见. 提交于 2019-12-11 09:42:54
问题 When using the LIKE/ILIKE operator in PostgreSQL 9 is it possible to match word boundaries without having to use full blown ~ operator regular expressions? For example SELECT 'Super fast training' ILIKE '%train\M%' as match; Where \M is the boundary at the end of a word and match returns false Thanks, Mark 回答1: you can do it with following trick: SELECT ' ' || 'Super fast training' ILIKE '%train %' but I don't hink so it is a good idea. You can use regular expression or PostgreSQL fulltext

Elasticsearch - Show index-wide count for each returned result based from a given term

和自甴很熟 提交于 2019-12-11 08:46:01
问题 Firstly i apologise if the terminology i use is incorrect as i am learning elasticsearch day by day and maybe use incorrect phrases. After spending several days trying to figure this out and pulling my hair out i seem to be hitting brick walls every-time. I am trying to get elasticsearch to provide a document count for each returned result, I will provide an example below.. { "suggest": { "text": "aberdeen", "city": { "completion": { "field": "city_suggest", "size": "2" } }, "street": {

iOS: How to avoid special characters being entered in a search bar?

让人想犯罪 __ 提交于 2019-12-11 08:44:57
问题 I may be looking at this incorrectly, but right now, if a user enters certain special characters in a search bar, the app will crash. These include \ and '. The apostrophe is a problem, in that words like "isn't" and "doesn't" will cause a crash How should I go about working around this problem? Many thanks 回答1: Before doing a search using the search string, pre-filter it, like this: NSString *safeSearchString = [[searchString componentsSeparatedByCharactersInSet:[[NSCharacterSet

SQL Server FullText on %searchKeyword%

百般思念 提交于 2019-12-11 08:09:16
问题 I was wondering if SQL Server is actually utilizing its fulltext index on searches that can be in the middle of text (such as LIKE %searchKeyword%)? I forgot where I read it, but I did read somewhere that the fulltext index would only be utilized when it is used in a "StartsWith" manner (searchKeyword%) where you search for a LIKE with a fixed beginning and a variable ending. Please let me know if this is true? 回答1: Full-text indexes (if you have them, they aren't enabled by default) are

Matching 2 out of 3 terms in Sunspot and WebSolr

笑着哭i 提交于 2019-12-11 07:57:25
问题 THe partial matching on my search is not working correctly. When I type in "Dublin Ireland" into my search then it correctly returns all the results in Dublin, Ireland. However, when I type "County Dublin Ireland" then it doesn't return any. I've set up an EdgeNGramFilter in my schmea.xml like so: <filter class="solr.EdgeNGramFilterFactory" minGramSize="1" maxGramSize="10"/> And I'm doing a fulltext search on the sunspot end on location: search_results = Events.solr_search do fulltext

Are IFilters necessary to index full text documents using Lucene.NET

那年仲夏 提交于 2019-12-11 07:39:11
问题 I am moving allong in my project and come to a crossroads dealing with the file content. I have successfully created a working index that has some classification fields but I am know looking to have keyword search applied to the file contents. My issue is I am not sure if passing lucene a reader would translate to the API indexing the entire file contents. I did some searching online and found suggestions that an IFilter would be needed is that true? It seems somewhat complicated. Anyways my

Search the Inbox content by given string

不打扰是莪最后的温柔 提交于 2019-12-11 07:26:34
问题 I want to develop an application, the small part of which will search the string of message from an EditText in the Inbox of my device.... I have referred some links like Search sms Inbox https://stackoverflow.com/questions/8941228/how-to-read-all-sms-from-inbox-in-android-2-2-and-above http://androidforums.com/android-applications/1773-how-read-sms-android.html Read all SMS from a particular sender but could not make it possible... can anyone plz help me with a useful piece of code...Thanks

Parameters in the FormsOf function and SQL injection

廉价感情. 提交于 2019-12-11 07:22:19
问题 Is the following SQL susceptible to SQL injection via the @SearchWord parameter? I want to use parameters with the FormsOf function, but the only guide to doing so I've found is in this Stack Overflow question: How to pass parameter to FormsOf function in sql server However the solution seems to be to use a bit of dynamic SQL, and I was wondering if that would be susceptible to SQL injection. What would happen in the following example if @searchWord contained a SQL injection type string? Is