search

Find strings in text

僤鯓⒐⒋嵵緔 提交于 2020-01-06 04:37:07
问题 I have a table with column "company_name". Now with some third party apps I receive short strings like this: Somebody has sent item to "stack-exchange" . I want to find row with stack-exchange company_name column from string. (In other words I want like operator to work the other way around). How to do this? EDIT: How to check if any of the values of company_name in your table match part of the string I receive? 回答1: Edit : Since you can't identify what part of the input string is the company

How do I rewrite the search function by adding a for loop to go through data.games and also add when I search that it says the score?

自作多情 提交于 2020-01-06 03:59:06
问题 $(document).ready(function(){ var textsearch = "XYZ" $.ajax({ dataType: 'jsonp', //data in jsonp contentType: "application/json; charset=utf-8", url: 'http://live.nhle.com/GameData/RegularSeasonScoreboardv3.jsonp', jsonpCallback: 'loadScoreboard', success: function (data) { console.log(data); if(textsearch) { for (var key in data) { if(data[key].hasOwnProperty('htn') && data[key].hasOwnProperty('atn')) { if((data[key]['htn'].toLowerCase()).indexOf(datasearch.toLowerCase()) != -1 || (data[key]

Cloudant: Searching across databases

陌路散爱 提交于 2020-01-06 03:30:13
问题 I have documents across 2 different databases: fruits, vegetables. It's easier for me to keep the databases separated. Now, suppose I want my user to search from any combination of these databases. Would it work if I run the same query across the three databases, and merge the result. That is: does the order field in a results have an absolute value, or is it relative to the other results? For example: Run my query on fruits db: { total_rows: 2, bookmark: "xxx", rows: [ { id: "Apple", order:

Priority Search Tree confusion

前提是你 提交于 2020-01-06 02:49:15
问题 The only reasonable slide set I found is this, which in page 15 says, for building: Sort all points by their x coordinate value and store them in the leaf nodes of a balanced binary tree (i.e., a range tree) Starting at the root, each node contains the point in its subtree with the maximum value for its y coordinate that has not been stored at a shallower depth in the tree; if no such node exists, then node is empty I implemented a Range Tree just before, so based on the example I used there,

Rails: Search in has_one association

北城以北 提交于 2020-01-06 02:38:06
问题 I have a model called User which has_one Player . A Player belongs_to a User . I want to find all the Players which Users attributes City has a particular value. Right now I have this in my Player model: def find User.find(:all, :conditions => ['city LIKE ?', "%#{city}%"]) end However that gives me the User. I want the Players which Users satisfy that condition. How do I do that? 回答1: Try this. Player.joins(:user).where('user.city LIKE ?', "%#{city}%") 来源: https://stackoverflow.com/questions

<input type=“search”> and jQuery Autocomplete

亡梦爱人 提交于 2020-01-05 15:05:08
问题 Once i change the type of the <input> element to the html5 type search , jQuery's Autocomplete functionality just won't work anymore. I use jQuery Mobile, and i am trying to use the "search" input type with jQuery UI Autocomplete 回答1: It's because the jQuery UI Autocomplete select only elements with type="text" Have you tried to attach the Autocomplete to the elements with id selector? 回答2: Using: <input type="text" data-type="search" /> will give the same visual results as <input type=

Better or Not combine Search Engine and Recommend System?

一世执手 提交于 2020-01-05 10:52:37
问题 In our project, we use search engine, but the result need to be ranked based on each user's interest, similar to recommendation according to users' keyword. If we separate the two system, it would cost a lot time. Is there a better way to combine Search Engine and Recommend System together? Or is there a simple way to customize my ranking strategy to achieve this? 回答1: This is what we were trying to do in our project as well. There are two things while solving this problem - Relevancy vs

MySQL search for 1,2,3,11,22,33 in field

荒凉一梦 提交于 2020-01-05 09:21:28
问题 Can I search for 1 AND 2 AND 3 without getting a false match because 11,22,33 are in the field? A field that has the string = "11,22,33" should then not return any results. 回答1: First of all, using comma separated values in a field is problematic, and you should consider storing them in a sepatate table instead. Then you could get the record more efficiently: select ... from mainTable t inner join valueTable v1 on v1.id = t.id and v1.value = 1 inner join valueTable v2 on v2.id = t.id and v2

Access Multi-field Search with Results as you type

风流意气都作罢 提交于 2020-01-05 09:02:22
问题 Good morning, all, My question today is regarding multi-field search. I have a split form (fields and individual record at the top, all data in datasheet view on the bottom). I have multiple fields I would like to search on, so that a user may find a particular person based on a number of criteria. Here is the VBA that a colleague helped me with that works PERFECTLY right now, and I'd like to add just a bit more functionality to it by allowing it to search on more than just the one field.

reverse phrase search in zend lucene

六眼飞鱼酱① 提交于 2020-01-05 08:27:56
问题 Basically I have two tables Location and city , The city has city_name and country_code. location_name field from location table has locations. I want to find the location country. My table structure. City table City country_code city_name US Kansas city ......... (thousands of world country cities) Location table Location location_name Kansas city, mo Kansas city Kansas city, us uSA, Kansas city etc... So I Indexed the two fields(country_code and city_name) in city table using Zend Lucene