search

Android onSearchRequested() callback to the calling activity

我是研究僧i 提交于 2020-01-01 18:19:09
问题 I have a MapActivity that will display the Android Search box when a search button is pressed. The SearchManager manages the dialog, and passes the user's query to a searchable activity, which searches an SQLite DB and displays the results using a custom adapter. This works fine - and I'm getting the correct results from the DB displayed. However, what I want to do is display the result in the MapActivity on a map when the user clicks on a search result. Currently, this means starting a new

Set iskeyword selectively

一笑奈何 提交于 2020-01-01 15:55:30
问题 Often I need to search large xml mode files for the next occurrence of the word under the cursor but preferably not if it's a tag the closing tag In the below example # is where the cursor is. Using * or # with iskeyword not including > or < will move between <Dealid> and </Dealid> . <Deali#d>4444</Dealid> ... 50 lines <Dealid>6666</Dealid> ... n lines <Dealid>5643</Dealid> I tried :set iskeyword+=< which worked fine for moving to the next match but it changed vey to include the < of the

fastest way to get parent array key in multidimensional arrays with php

与世无争的帅哥 提交于 2020-01-01 13:01:06
问题 what is the best way to get parent array key with multidimensional arrays? for example I have this array: array( [0] => array(0=> sample, 1=>picture, 2=>frame, 3=>google) [1] => array(0=> iphone, 1=>orange, 2=>love, 3=>msn) [2] => array(0=> joe, 1=>geee, 2=>panda, 3=>yahoo) ) now I need to search for example google and get the parent array key.. which it should be 0...any ideas? I used for loop for this but I think it will be slow if I have arrays with 700000 rows.. 回答1: If you have an array

Is ThreadPool appropriate for this threading scenario?

扶醉桌前 提交于 2020-01-01 11:46:12
问题 I have a scenario that I'm trying to turn into a more responsive UI by pre-fetching some sub-elements of the results before they're actually required by the user if possible. I'm unclear on how best to approach the threading, so I'm hoping someone can provide some advice. Scenario There is search form (.NET rich client) that enable the user to select an account for a given customer. The user searches for given text to find a collection of customers which are then displayed in a result grid.

Laravel - Query Model if values contain a certain string (taken from search input)

瘦欲@ 提交于 2020-01-01 10:47:13
问题 I am implementing a search using Laravel and Ajax. So I have a Product which belongs to a Tag and a Subcategory. On the other hand the Subcategory belongs to a Category. I want to check all of their properties (field values) and check if they contain the given string. With some searching I found out that I have to use LIKE . Here is what I tried: $products = Product::where('name_en', 'LIKE', $search)->get(); However this will get the products if the search string matches exactly the value. I

Testing Escaped Fragment Search with Webmaster Tools

孤街浪徒 提交于 2020-01-01 09:59:06
问题 My site is in AngularJS, so I recently created HTML snapshots of all my content, added the escaped fragment tag to the head of all my pages (meta name="fragment" content="!"), and then tried to test to see if the new setup was working in Webmaster Tools. When I look in the source I see the escaped fragment (however, it's inverted) (meta content="!" name="fragment"). I'm not sure why that's happening or if that matters... When I submit a URL to "Fetch as Google," Webmaster Tools returns Fetch

Elasticsearch wildcard search on not_analyzed field

余生长醉 提交于 2020-01-01 09:24:15
问题 I have an index like following settings and mapping; { "settings":{ "index":{ "analysis":{ "analyzer":{ "analyzer_keyword":{ "tokenizer":"keyword", "filter":"lowercase" } } } } }, "mappings":{ "product":{ "properties":{ "name":{ "analyzer":"analyzer_keyword", "type":"string", "index": "not_analyzed" } } } } } I am struggling with making an implementation for wildcard search on name field. My example data like this; [ {"name": "SVF-123"}, {"name": "SVF-234"} ] When I perform following query;

How can I support wildcards in user-defined search strings in Python?

不想你离开。 提交于 2020-01-01 09:12:17
问题 Is there a simple way to support wildcards ("*") when searching strings - without using RegEx? Users are supposed to enter search terms using wildcards, but should not have to deal with the complexity of RegEx: "foo*" => str.startswith("foo") "*foo" => str.endswith("foo") "*foo*" => "foo" in str (it gets more complicated when there are multiple search terms though, e.g. "foo bar baz") This seems like a common issue, so I wonder whether there's a ready-made solution for it. Any help would be

whats the fastest string collection structure/algorithm for startswith and/or contains searches

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-01 08:57:25
问题 I have the following situation: I have a big collection of strings (lets say 250.000+) of average length of maybe 30. What I have to do is to do many searches within these .. mostly those will be of StartsWith and Contains kind. The collection is static at runtime. Which means the initial reading and filling of the collection of choice is done only once .. therefore the performance of building the datastructure is absolutely not important. Memory is also not a problem: which also means that I

How can C#'s string.IndexOf perform so fast, 10 times faster than ordinary for loop find?

萝らか妹 提交于 2020-01-01 08:14:07
问题 I have a very long string ( 60MB in size) in which I need to find how many pairs of '<' and '>' are in there. I have first tried my own way: char pre = '!'; int match1 = 0; for (int j = 0; j < html.Length; j++) { char c = html[j]; if (pre == '<' && c == '>') //find a match { pre = '!'; match1++; } else if (pre == '!' && c == '<') pre = '<'; } The above code runs on my string for roughly 1000 ms . Then I tried using string.IndexOf int match2 = 0; int index = -1; do { index = html.IndexOf('<',