search

Android - how to disable long press on Search button (Nexus One)

别等时光非礼了梦想. 提交于 2019-12-30 05:23:21
问题 The Android documentation describes how to disable the search the search feature in Activity: public boolean onSearchRequested() { return false; } This works fine for a short press of the search button on the Nexus One. However, it doesn't disable the long press, which still fires off a voice search. How do I disable the long press Voice search? Thanks... 回答1: I extended Stan's answer to only disable long press events. @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if

Simple Solr schema problem for autocomplete

本秂侑毒 提交于 2019-12-30 05:18:09
问题 I have a very simple SQL table that I want to import into Solr but because of the features I want for search I can't determine the best schema. The user will start typing into an input box and after 3 characters it will send the request to the server and pull out the most relevant results returning the top 15 matching id and name. Table ex) id | name ---------------- 1 | boating magazines 2 | boats weekly 3 | boaters collection 4 | shipping lane 5 | ships today Search and expected return ex)

Highlight search text in mysql php search

杀马特。学长 韩版系。学妹 提交于 2019-12-30 05:10:10
问题 hi this is the script i have, it works well to search my database. i have a form.html where the user inputs the keyword in a search box. <form method="get" action="form.php"> <input type="text" name="searchterm" title="Enter your search term here" value="Enter your search term here" class="searchbox" /> <input type="submit" name="search" title="Search Now! "value="Search" class="searchbutton" /> </form> i would like to highlight the search text in the result. many thanks form.php <!DOCTYPE

Rails Search Across Multiple Models

自作多情 提交于 2019-12-30 04:35:11
问题 I have an issue. I have a show view that acts as a dashboard and brings in records from other models and then models associated to that. I have a simple search form that is working fine to search through one model, but I don't know how to have it look through its associated models as well. I don't think a full text search is necessary and I am not sure how it would work because I don't want something that is going to search across the whole site. Thanks companies/show/1 <div id="form"> <div

SQL design approach for searching a table with an unlimited number of bit fields

扶醉桌前 提交于 2019-12-30 03:21:15
问题 Consider searching a table that contains Apartment Rental Information: A client using the interface selects a number of criteria that are represented as bit fields in the DB, for instance: AllowsPets HasParking HasDeck ModernKitchen etc.. We are facing a situation where each new client of our software has additional fields they want to allow their end users to search on. The number of bit fields could reach into the hundreds. I have three approaches that I'm considering and hoping for input

jquery/javascript check string for multiple substrings

点点圈 提交于 2019-12-30 02:32:05
问题 I need to check if a string has one of three substrings, and if yes, to implement a function. I know I can check for one substring using if (str.indexOf("term1") >= 0) but is there a way to check for multiple substrings short of using several instances of this code? TIA 回答1: if (/term1|term2|term3/.test("your string")) { //youre code } 回答2: You could use a loop. Maybe even create a helper function like so: function ContainsAny(str, items){ for(var i in items){ var item = items[i]; if (str

Searching for phone numbers in mysql

徘徊边缘 提交于 2019-12-30 02:08:24
问题 I have a table which is full of arbitrarily formatted phone numbers, like this 027 123 5644 021 393-5593 (07) 123 456 042123456 I need to search for a phone number in a similarly arbitrary format ( e.g. 07123456 should find the entry (07) 123 456 The way I'd do this in a normal programming language is to strip all the non-digit characters out of the 'needle', then go through each number in the haystack, strip all non-digit characters out of it, then compare against the needle, eg (in ruby)

Binary search of a C# list using delegate condition

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-30 01:23:08
问题 I have a List<T> that I want to search not for a given item but for an item satisfying a given condition. Given an item in the list I can test which of 4 conditions is true: the desired item must be to the left the desired item must be to the right this is the desired item the desired can't be in the list A quick glance at the list functions was not encouraging so I'm wondering if anyone knows off a function I can use? Edit: this is a local temp list so I known that it will be sorted

Search multiple models at once with Ransack

烂漫一生 提交于 2019-12-29 17:47:05
问题 I have a search form in the header of my app and I would like to use this search form to search through multiple models within the application. For example a request like /search?q=rails should trigger a search through multiple models like Work , Project , User and their defined attributes. I wanted to use Ransack because I already use it on the Work model in a different area of the app. I think I don't quite understand Ransack yet and the documentation always points out that you have to

Search multiple models at once with Ransack

 ̄綄美尐妖づ 提交于 2019-12-29 17:45:12
问题 I have a search form in the header of my app and I would like to use this search form to search through multiple models within the application. For example a request like /search?q=rails should trigger a search through multiple models like Work , Project , User and their defined attributes. I wanted to use Ransack because I already use it on the Work model in a different area of the app. I think I don't quite understand Ransack yet and the documentation always points out that you have to