search

comparing strings in PostgreSQL

眉间皱痕 提交于 2020-01-11 12:21:50
问题 Is there any way in PostgreSQL to convert UTF-8 characters to "similar" ASCII characters? String glāžšķūņu rūķīši would have to be converted to glazskunu rukisi . UTF-8 text is not in some specific language, it might be in Latvian, Russian, English, Italian or any other language. This is needed for using in where clause, so it might be just "comparing strings" rather than "converting strings". I tried using convert , but it does not give desired results (e.g., select convert('Ā', 'utf8', 'sql

comparing strings in PostgreSQL

穿精又带淫゛_ 提交于 2020-01-11 12:21:17
问题 Is there any way in PostgreSQL to convert UTF-8 characters to "similar" ASCII characters? String glāžšķūņu rūķīši would have to be converted to glazskunu rukisi . UTF-8 text is not in some specific language, it might be in Latvian, Russian, English, Italian or any other language. This is needed for using in where clause, so it might be just "comparing strings" rather than "converting strings". I tried using convert , but it does not give desired results (e.g., select convert('Ā', 'utf8', 'sql

Get search word Hits ( number of occurences) per document in Lucene

ⅰ亾dé卋堺 提交于 2020-01-11 11:48:25
问题 Can any one suggest me the best way to get Hits( no of occurrences ) of a word per document in Lucene?.. 回答1: Lucene uses a field-based, rather than document-based, index. In order to get term counts per document: Iterate over documents using IndexReader.document() and isDeleted(). In document d, iterate over fields using Document.getFields(). For each field f, get terms using getTermFreqVector(). Go over the term vector and sum frequencies per terms. The sum of term frequencies per field

Efficiency of Searching an Array Vs Searching in Text… Which is Better?

≡放荡痞女 提交于 2020-01-11 10:35:09
问题 I have a List of (integer)ID's, which i am storing as text, like 23;45;67;12;332;783;123;33;15;87;41;422;88;58; now i am working with PHP, i want to check if a particular ID already exists in that TEXT, i have the explode function, which can give me an array of numbers , and then i can use the in_array function, alternatively i can just use the strpos function to find in text . so which one will be more efficient accourding to you ? Thanks a lot for taking time to read this. 回答1: If all you

help on building a basic php search engine

坚强是说给别人听的谎言 提交于 2020-01-11 10:34:10
问题 i looked for tutorials everywhere but just can't seem to get a good one... a search page with pagination, column header sorting, and multiple filtering(filters are in checkboxes) the problem: had pagination working, had sorting working, but can't get them to work together. add to that getting the filters working with a paginated and sorted resultset i want to make this work with php alone and with GET form methods alone (javascript comes in later, I want to apply progressive enhancement on

Solr - most frequent searched words

℡╲_俬逩灬. 提交于 2020-01-11 09:18:05
问题 I'm trying to organize a solr search engine. I've already set up the misspelling system and the suggestions. However I can't seem to find how to retrieve the top 10 most searched words/terms/keywords in solr/lucene. How can I get this? I want to display those on my homepage. 回答1: Solr does not provide this kind of feature out of the box. There is the StatsComponent, that provides you with all kind of statistics, but all of those are numeric only. Depending on how you access solr (directly or

Wildcard search in cassandra database

送分小仙女□ 提交于 2020-01-11 08:24:22
问题 I want to know if there is any way to perform wildcard searches in cassandra database. e.g. select KEY,username,password from User where username='\*hello*'; Or select KEY,username,password from User where username='%hello%'; something like this. 回答1: There is no native way to perform such queries in Cassandra. Typical options to achieve the same are a) Maintain an index yourself on likely search terms. For example, whenever you are inserting an entry which has hello in the username, insert

How do I visual select a calculation backwards?

孤者浪人 提交于 2020-01-11 07:22:07
问题 I would like to visual select backwards a calculation p.e. 200 + 3 This is my text -300 +2 + (9*3) |-------------|* This is text 0,25 + 2.000 + sqrt(15/1.5) |-------------------------|* The reason is that I will use it in insert mode. After writing a calculation I want to select the calculation (using a map) and put the results of the calculation in the text. What the regex must do is: - select from the cursor (see * in above example) backwards to the start of the calculation (including \/-+*

How do I sort the search results according to the number of items in ElasticSearch?

余生颓废 提交于 2020-01-11 06:42:48
问题 Let's say that I store documents like this in ElasticSearch: { 'name':'user name', 'age':43, 'location':'CA, USA', 'bio':'into java, scala, python ..etc.', 'tags':['java','scala','python','django','lift'] } And let's say that I search using location=CA, how can I sort the results according to the number of the items in 'tags'? I would like to list the people with the most number of tag in the first page. 回答1: You can do it indexing an additional field which contains the number of tags, on

Retrieve set of rectangles containing a specified point

∥☆過路亽.° 提交于 2020-01-11 06:14:06
问题 I can't figure out how to implement this in a performing way, so I decided to ask you guys. I have a list of rectangles - actually atm only squares, but I might have to migrate to rectangles later, so let's stick to them and keep it a bit more general - in a 2 dimensional space. Each rectangle is specified by two points, rectangles can overlap and I don't care all too much about setup time, because the rectangles are basicly static and there's some room for precalculate any setup stuff (like