Embodiment
The exemplary embodiment of the disclosure is more fully described below with reference to accompanying drawings.Although showing the disclosure in accompanying drawing
Exemplary embodiment, it being understood, however, that may be realized in various forms the disclosure without should be by embodiments set forth here
Limited.On the contrary, these embodiments are provided to facilitate a more thoroughly understanding of the present invention, and can be by the scope of the present disclosure
Complete conveys to those skilled in the art.
It is existing based on search and webpage scan for switching method, need switching search and webpage scan for when, it is necessary to
User scans in current search webpage input target search info web, obtains search result, and obtained from search result
Take target search webpage to switch over, and substantive search is carried out in target search webpage after handover, search routine is more numerous
It is trivial so that needed for search time is longer, search efficiency is relatively low;Further, it is necessary to by working as before substantive search is carried out
Preceding search and webpage carries out target search Webpage search, adds search flow.
Existing search and webpage or non-search webpage, can be searched based on toolbar search box or searched page search box
Rope, but toolbar search box and searched page search box are separate.In the embodiment of the present invention, it is considered to search for toolbar
Frame is associated with searched page search box, when user inputs target search webpage in the searched page search box of search and webpage
Search key is extracted in information, the target search info web that browser is inputted from user, and search key is illustrated in
In toolbar search box, when user, which clicks on, is illustrated in the search key in toolbar search box, toolbar search box is triggered
According to the search key of displaying, the search and webpage storehouse of the search key mapping pre-set is loaded, user is from loading
Required target search webpage is chosen in search and webpage storehouse, so that current search webpage is switched in the target search webpage
Carry out substantive search.So, without performing search in current search webpage and waiting search result, search routine is more simple
Single, time needed for search is short, search efficiency is higher, and can effectively save search flow.
Fig. 1 is that the embodiment of the present invention searches for switching method schematic flow sheet.Referring to Fig. 1, the flow includes:
Step 101, the search information in the searched page search box of current search webpage is obtained, the search information is extracted
In the crucial words that includes;
In this step, user is when needing to carry out information search, if it is considered to the search engine that current search webpage is provided
Search effect it is relatively low, it is necessary to switching to him thinks that the corresponding search and webpage of relatively good search engine is scanned for, then can be with
In the searched page search box of current search webpage, input includes the search letter of the corresponding search and webpage of Targeted Search Engine
Breath.For example, current search and webpage is Baidu search webpage, but user needs to scan in 360 search and webpages, then can be with
In the searched page search box of Baidu search webpage, input " 360 " or " 360 search engine " etc. search information.Browser is obtained
The search information that family is inputted in the searched page search box of current search webpage is taken, and carries out keyword word extraction.
As alternative embodiment, the search information of acquisition can be split by participle cutting method, then, to cutting
The words divided carries out meaningless word removal, finally, and the words obtained after meaningless word removal processing is combined, obtained
Crucial words.
As another alternative embodiment, due to carrying out words cutting to search information using participle cutting method, and to cutting
The words divided carries out meaningless word removal, can't effectively remove information unrelated with search and webpage in search information.For example, with
The search information of family input is " network address of 360 secure browsers is ", then is removed and words by words cutting, meaningless word
After combination, the crucial words extracted is " 360, safety, browser, network address is ", and for search and webpage, " peace
Entirely ", " browser " and "Yes" are probably the information unrelated with search and webpage, reduce the business experience of user.Thus, this hair
In bright embodiment, it can further include:
A11, calculates the term frequency-inverse document word frequency of each crucial words extracted;
In this step, term frequency-inverse document word frequency (TF-IDF, Term Frequency-Inverse Document
Frequency) it is a kind of conventional weighted statistical method for information retrieval.Wherein, word frequency is to assess a words for one
The weight of a copy of it document in individual document library (file set or corpus), the weight of words is as the words is in document library
The number of times of appearance is directly proportional increase, the decline while frequency occurred with the words in document library is inversely proportional;Inverse document word frequency
It is the measurement of a words general importance.If TF-IDF weight value is bigger, the indicative better of the words is represented.
The formula for calculating the term frequency-inverse document word frequency value of crucial words can be as follows:
In formula,
TF is the word frequency of crucial words;
IDF is the inverse document word frequency of crucial words;
N' is the number of times that crucial words occurs in the search and webpage sample set pre-set;
N is the total quantity of each crucial words in search and webpage sample set;
D is total dragnet number of pages that crucial words is included in search and webpage sample set;
D' is to search for the total dragnet number of pages included in sample set;
+ 1 is smoothing processing.
A12, judges whether the term frequency-inverse document word frequency value of the crucial words calculated is not less than the threshold value pre-set, such as
Fruit is to extract the crucial words, otherwise, filters out the crucial words.
It is the switching applied to search and webpage in the embodiment of the present invention, and the search and webpage based on switching is scanned for.Cause
And, as alternative embodiment, before the search information in the searched page search box for obtaining current search webpage, this method can
To further comprise:
A21, obtains current web page information;
In this step, browser can obtain info web by extracting the information in address field.Wherein, in address field
Information can be URL (URL, Uniform Resource Locator) information, for example,http:// www.so.com/sIe=utf-8&src=hao_360so&shb=1&q=URLOr IP address information etc..Preferably
Ground, for URL information, can be extracted, for example, above-mentioned URL information is extracted by filtering according to the rule pre-set
Afterwards, the information obtained can be:www.so.com.On extracting URLInformation, is known technology, for details, reference can be made to correlation technique
Document, detailed description is omitted here.
As alternative embodiment, obtaining current web page information includes:
A111, writes the class for being inherited from WebContentsObserver, monitors Webpage loading completion event;
In this step, Webpage loading completion event is DidCommitProvisionalLoadForFrame events.
Completion event is loaded by the Webpage, uniform resource locator (URL) information of the current web page page can be obtained.
In the embodiment of the present invention, WebContentsObserver class is inherited from by writing, can be monitored
DidCommitProvisionalLoadForFrame events.
A112, after Webpage loading completion event is listened to, obtains the Webpage loading completion event transmission
Info web.
In this step, info web is URL information.
A22, it is determined that obtain current web page information be search and webpage information after, perform it is described acquisition current search webpage
Searched page search box in search information flow.
Search and webpage information collection is previously stored with this step, in browser.Thus, as alternative embodiment, it is determined that obtaining
The current web page information taken is that search and webpage information includes:
A31, the current web page information of acquisition is matched with the search and webpage information collection pre-set;
Can be that the search and webpage information collection by the URL information in address field with pre-setting is matched in this step,
Can also will be matched in address field by filtering search and webpage information collection of the URL information extracted with pre-setting.
That is, judge whether the URL information obtained is search engine page info, for example, if for Google, Baidu, 360 search etc.
Search engine page info, wherein, Google is http://*.google.c*/search* q=*, Baidu is http://
www.baidu.com/sWd=*, 360 search are http://so.360.cn/sQ=*.
In this step, as preferred embodiment, search and webpage information collection can also be loaded into caching in advance, with effective
Matching efficiency is lifted, the time needed for matching is reduced.
A32, if the current web page information obtained concentrates any info web to match with search and webpage information, it is determined that obtaining
The current web page information taken is search and webpage information.
In this step, search and webpage information collection can use Wildcard Expressions matching method, wherein, asterisk wildcard can be wrapped
Include:Asterisk (*), and/or, question mark (), and/or, connector (| |), for carrying out fuzzy matching., can in the embodiment of the present invention
To replace zero, one or more characters using asterisk, a character is replaced with question mark.For example, asterisk wildcard matching expression can
To be:
http://www.baidu.com/*.*.Wherein,
*, asterisk, as asterisk wildcard, matches any character string.
Specifically, if it is determined that the URL information of acquisition is search engine page info, then parses
What is included in the URL information of DidCommitProvisionalLoadForFrame events transmission, the URL information for obtaining transmission searches
Rope information.For example, as it was previously stated, Google is http://*.google.c*/search* q=*, Baidu is http://
www.baidu.com/sWd=*, 360 search are http://so.360.cn/sQ=*.Wherein, inputted after equal sign for user
Search information (crucial words), for example, if user input search information be 360, in http://
so.360.cn/sIt is 360 in q=*, after equal sign.So, it is possible to use the rule extracts the search information after equal sign.
As alternative embodiment, before (cutting) is extracted to the search information of acquisition, this method further comprises:
The coded format of search information is obtained, search information is decoded according to the coded format of acquisition.
It is different according to coded format for the search information obtained by rule in this step, carry out corresponding decoding, example
Such as, the decoding such as UTF-8, GBK is carried out.
In the embodiment of the present invention, if it is determined that the current web page information of acquisition is not search and webpage information, then according to existing
Flow is handled, detailed description is omitted here.
Step 102, the crucial words of extraction is exported into the toolbar search box of current search webpage;
In this step, browser is obtaining the search information of user's input, and carries out after keyword word extraction, will extract
To crucial words input to toolbar search box.
In the embodiment of the present invention, by extracting the search key word included in the search information that user inputs, and automatically
It is filled into toolbar search box, so, is conducive to subsequently using the crucial words of current search to be switched fast other search engines
Scan for.Solve in the prior art, search key word is inputted in the searched page search box of searched page, it is impossible to will
Search key word extracts the technical problem in toolbar search box.For example, Firefox browser, cheetah browser and
The browsers such as sogou browser, input search key word, it is impossible to by the search key of input in searched page search box
Word is extracted in toolbar search box.Wherein, search key word, which is extracted, refers to be directed to search and webpage, for example, 360 dragnets
Page, Baidu search webpage, Google search webpage, the keyword extraction in searched page search box is come out, is filled into automatically clear
Look at the search box of device, i.e., in toolbar search box.
Step 103, the dragnet of the search key word mapping pre-set is loaded in the toolbar search box
Page word bank;
In this step, as alternative embodiment, the search pre-set is loaded in the toolbar search box crucial
The search and webpage word bank of words mapping includes:
B11, inquires about the search and webpage storehouse that pre-sets, the search and webpage storehouse by each search key word map it is corresponding
Search and webpage word bank is constituted;
In this step, each search key word maps a search and webpage word bank, the phase of multiple search key word mappings
Search and webpage word bank is answered to constitute search and webpage storehouse.
Can be that multiple search key words map same search and webpage word bank as alternative embodiment, for example, for
Multiple search key words such as " 360, network address ", " 360, browser " and " 360, safety, browser, network address ", map 360
Search and webpage word bank.
As alternative embodiment, in the embodiment of the present invention, search and webpage word bank can include one or more search and webpages.
For example, exemplified by 360 search and webpage word banks, can include:360 search, Google, Baidu, have and the searched page such as Taobao.
Search key word in B12, traversal search web page library, the search for obtaining the crucial words matching of the extraction is closed
Key words, loads the search and webpage word bank of the search key word mapping of the matching.
In this step, the flow that the flow of crucial words matching is matched with foregoing info web is similar, is omitted here in detail
State.
In the embodiment of the present invention, as alternative embodiment, in loading search and webpage word bank, search and webpage of loading is set
Storehouse is in hidden state, i.e., in the toolbar search box, the crucial words that only display is exported from searched page search box.
If for example, the crucial words of searched page search box output is 360, in toolbar search box, showing 360.Certainly, it is real
In the application of border, the search and webpage word bank of loading after loading search and webpage word bank, can also be set to be in dispaly state, i.e., in work
Have in column search box, 360 search and webpage word banks of the mapping of display 360 and 360.
As another alternative embodiment, search and webpage word bank can be shown in control icons mode, thus, in loading
After search and webpage word bank, this method may further include:
The icon of the search and webpage word bank of the mapping is obtained, is extracted search and webpage word bank icon as control with described
Crucial words be shown in the toolbar search box.
As alternative embodiment, if there is no the search key of the crucial words matching of the extraction in search and webpage storehouse
Word, this method can further include:
The crucial words extracted is preserved, and builds the mapping for the search and webpage that the crucial words of extraction is set with user and is closed
System.
In this step, crucial words is saved in the WebContentsImpl classes related to the search and webpage page, also
It is to say, search and webpage storehouse is also stored in WebContentsImpl classes, in WebContentsImpl classes,
SetSearchText () function is used to preserve crucial words, and GetSearchText () function is used to extract crucial words.Answer
Illustrate, crucial words is related to the search and webpage page.
Step 104, the handover request of the crucial words in the toolbar search box is received, from the search and webpage of loading
Target search webpage is read in word bank, and switches to the target search webpage of reading to scan for.
In this step, if the user determine that needing to scan for page layout switch, then inputted in searched page search box related
Information is searched for, and is shown in toolbar search box after crucial words, by clicking on the crucial words of the display, so as to trigger
Toolbar search box sends handover request to browser.
As another alternative embodiment, if as it was previously stated, showing crucial words and search in toolbar search box
Webpage word bank icon, then by clicking on search and webpage word bank icon, triggering toolbar search box sends handover request to browser.
In the embodiment of the present invention, after search and webpage word bank icon is clicked on, search and webpage is shown in the way of drop-down menu
Word bank.
Fig. 2 is that the embodiment of the present invention clicks on the toolbar search box interfacial structure signal shown after search and webpage word bank icon
Figure.Referring to Fig. 2, drop-down menu includes:360 search, Google, Baidu, have, Taobao, automatically extract page search term and
Set.So, user is inputted after search term 360 in searched page search box, and search term 360 is extracted, by extraction
Crucial words 360 is exported into toolbar search box, and shows in toolbar search box the corresponding dragnet of crucial words 360
Page word bank icon (control), after search and webpage word bank icon is clicked on, shows search and webpage word bank in the way of drop-down menu, uses
Family can choose the search and webpage for needing to be switched to from drop-down menu, for example, choosing Baidu, then switch current search webpage
Scanned for Baidu search webpage, and in Baidu search webpage, other search can be chosen from drop-down list in order to user
Rope webpage, so as to scan for engine switching, realizes being switched fast for other search engines.On search after handover
Scanned in webpage, be known technology, detailed description is omitted here.
In practical application, the existing input search information in toolbar search box is when scanning for, it is impossible to defeated according to user
The prompt message of the search information displaying correlation entered.When inputting keyword i.e. in toolbar search box, it will not be searched in toolbar
One or more crucial words of the supplement related to input keyword appear below in rope frame, thus, in the embodiment of the present invention, the party
Method further comprises:
C11, the search information that monitoring user inputs in toolbar search box sequentially extracts the search letter of user's input
Breath;
In this step, as alternative embodiment, sequentially extracting the search information of user's input includes:
Monitor that user often inputs a character, extract the character of user input.So, the user's input once extracted after
Character includes previous user inputs character and a character in front and rear input.That is, it is defeated to extract the user
The character entered is to extract all characters that the user inputs before this, and real-time is stronger.
As another alternative embodiment, sequentially extracting the search information of user's input includes:
According to the character length threshold value pre-set, after monitoring that user's input meets the character of character length threshold value,
Extract the character of user input.So, the change frequency of the follow-up crucial words of supplement shown to user can effectively be reduced.
The crucial word list of the search information of extraction and the supplement that pre-sets, is sequentially compared, obtains and carry by C12
The crucial words of supplement of the search information match taken;
In this step, as alternative embodiment, obtaining the crucial words of supplement of the search information match with extracting includes:
If there is the crucial words of supplement that can be in full matched with the search information of extraction in the crucial word list of supplement, obtain
The crucial words of supplement matched in full to the search information with extraction;Can be with carrying if be not present in the crucial word list of supplement
The crucial words of supplement that the search information taken is matched in full, then carry out fuzzy matching, obtain the search information fuzzy with extracting
The crucial words of supplement matched somebody with somebody.
Certainly, in practical application, as another alternative embodiment, the supplement for obtaining the search information match with extracting is closed
Key words includes:
If the crucial words number of supplement matched in full with the search information of extraction in the crucial word list of supplement is less than pre-
The display number threshold value first set, carries out fuzzy matching, is met being matched in full with the search information of extraction for display number threshold value
With the crucial words of supplement of fuzzy matching.
In the embodiment of the present invention, as alternative embodiment, when user's click tools column search box sets focus, or toolbar
When the text inputted in search box changes, the word in toolbar search box is obtained, if word is not sky, one is built
Individual HTTP GET request, accesses 360 search servers, obtains the crucial word list of supplement.Wherein, it is crucial for providing supplement
360 search server interface IP addresses of word list are:
http://sug.so.360.cn/suggestWord=*&callback=suggest360&encodein=
Utf-8&encodeout=utf-8&_h=18.js&outfmt=json, wherein, * is the keyword encoded using UTF-8
Word.
The data for the crucial word list of supplement that 360 search servers are returned are JSON forms:["*",
[" * * ", " * * * ", " * * * * "]], parsed according to the JSON forms, the crucial word list of the supplement decoded.Certainly,
In practical application, information matches can also be scanned in 360 search servers, the use UTF-8 codings of matching are returned
Crucial words, can be set and at most return to ten crucial words, and toolbar search box is filled out according to the number of the crucial words of return
It is charged in homemade supplemental pulldown menu list window (drop-down list).
C13, the crucial words of obtained supplement is included in the toolbar search box in real time as drop-down list.
In this step, the crucial words of obtained supplement will be matched and shown in real time as drop-down list, can in order to
The search information of needs is chosen at family from drop-down list, so that the input character needed for user is effectively reduced, reduction user's input
Intensity, lifted user business experience, solve and input keyword in toolbar search box in the prior art, it is impossible to ejection with
The crucial words of supplement matched in the crucial word list of supplement so that when inputting keyword in toolbar search box, it is necessary to
The complete word of input can just be scanned for, if moreover, input error, the technical problem do not pointed out correctly.Further, lead to
Display in real time is crossed so that user can be browsed with convenient to carry out, so that more accurate choose the search information needed.
As alternative embodiment, the crucial words of the supplement that can also choose user from drop-down list is counted, with
Sequential bits of the crucial words of supplement that the selection is adjusted according to count value in drop-down list and the crucial word list of supplement.
Fig. 3 is that the embodiment of the present invention inputs the crucial words drop-down menu of the supplement shown after 360 in toolbar search box
Schematic diagram.Referring to Fig. 3, in the embodiment of the present invention, so that three characters of every input are extracted to the search information of input as an example, use
Family inputs search term in toolbar search box, for example, input 360, after browser extracts 360, with the supplement pass pre-set
Key word list is matched, so as to obtain the crucial words of multiple supplements related to 360.Wherein, shown in drop-down menu
The corresponding multiple crucial words of supplement of search term 360 can include:360 security guards download, 360 cloud disks, 360 browsers, 360
Mobile phone bodyguard, 360 security guards, 360 safety desktops, 360 video display, 360 Dropbox, 360 weather, 360 free Dropbox etc..So,
User downloads if necessary to search for 360 security guards, then can click directly on 360 security guards download, so that 360 safety be defended
Scholar downloads and is input in toolbar search box to scan for, and inputs characters such as " security guard's downloads " again without user, so that
Effectively reduce the input intensity of user.
As alternative embodiment, the crucial word list of supplement can be the list that 360 search engines are pre-set.
In practical application, because browser typically has multi-tag pattern, i.e., in a browser window, it can access
The different web pages such as 360 search and webpages, youku.com's webpage, Sina's webpage., can be with implementation tool column search box in the embodiment of the present invention
Middle content switches with Webpage and occurs dynamic change, and this method may further include:
D11, TabStripModel::ActivateTabAt initiates Webpage switching, is used to monitor to browser window
The SearchRequestObserver classes of Webpage handover request, which are sent, notifies ActiveTabChanged events;
In this step, it is by TabStripModel that Webpage handover request, which is notified,::ActivateTabAt is initiated, to
Listener, i.e. browser (Browser) window is used for the SearchRequestObserver classes for monitoring Webpage handover request
Send and notify ActiveTabChanged events.Wherein, i.e. Webpage switching browser label switching.Should
SearchRequestObserver classes are pre-created for the embodiment of the present invention, for monitoring Webpage handover request.
D12, browser window notifies browser class after notice ActiveTabChanged events are received
(BrowserView);
Webpage handover request is transmitted to browser toolbar class (ToolbarView) by D13, browser class;
D14, in ToolbarView::In Update functions, add the renewal (Update) to toolbar search box and operate;
In this step, Webpage handover request is transmitted to ToolbarView by BrowserView.Due to toolbar search
Frame is ToolbarView daughter element, so in ToolbarView::In Update functions, add to toolbar search box
Update is operated.So, after the renewal of the Update functions of browser toolbar class is called, it can directly invoke and set in advance
The toolbar search box put, to be updated to content in toolbar search box.
In the embodiment of the present invention, in ToolbarView::In Update functions, the renewal to toolbar search box is added
(Update) operation includes:
In ToolbarView::In Update function bodies, program code segments search_bar_- is added>Update().
D15, toolbar search box passes through WebContentsImpl classes according to the Webpage after switching
GetSearchText () function obtains the search key word of the Webpage mapping after the switching;
In this step, the Webpage after the switching turns into the current web page page.
D16, whether the search key word for judging the mapping of the Webpage after the switching is empty, if crucial words is not
For sky, then in the toolbar search box for the Webpage being substituted into after switching, if sky, then do not process.
In the embodiment of the present invention, it is possible to achieve content switches and changed with Webpage in toolbar search box.For example, setting
The search key word of 360 search and webpages mapping is " 123 ", and the search key word of Baidu search webpage mapping is " 456 ", newly
The search key word of unrestrained webpage mapping is sky.So, when user is switched in the 360 search and webpage pages, then 360 is extracted and is searched
The search key word of rope webpage mapping is " 123 ", then is shown to 123 in current toolbar search box.Then, it is switched to
In Baidu's Webpage, the search key word for extracting Baidu's webpage mapping is " 456 ", then is shown to " 456 " current
In toolbar search box.Finally, then it is switched in Sina's Webpage, because Sina's Webpage is not searched page, mapping
Search key word for sky, it is no extraction keyword, then content is constant in current tool column search box, be sky.
Fig. 4 is the idiographic flow schematic diagram that the embodiment of the present invention shows search key word in toolbar search box.Ginseng
See Fig. 4, the flow includes:
Step 401, user initiates searching request;
Step 402, RenderViewHostImpl is called::OnNavigate;
Step 403, WebContentsImpl is passed through::The search that DidNavigate obtains current web page page-map is closed
Key words;
Step 404, DidCommitProvisionalLoadForFrame event messages are sent;
Step 405, SearchRequestObserver is passed through::DidCommitProvisionalLoadForFra me
Transmit URL information;
Step 402 to step 405 is calling for CHROME codes itself, that is, accesses the start flow of a webpage, this hair
Bright embodiment is one and quotes to briefly explain initiation mode.
Step 406, the matching of engine network address is scanned for current accessed network address (URL information);
Step 407, whether be search engine network address, if it is, performing step 408, otherwise, terminate stream if judging matching result
Journey;
Step 408, network address is parsed by preset rules, extracts search key;
Step 409, judge whether search key extracts success, if it is, performing step 410, otherwise, terminate flow;
Step 410, the search key of extraction is included in toolbar search box.
From above-mentioned, the searching method of the embodiment of the present invention, when needing switching search and webpage, it is only necessary to which user is working as
Target search info web is inputted in the searched page search box of preceding search and webpage, exported after crucial words is extracted to instrument
In column search box, and the search and webpage word bank that the search key word maps is loaded in toolbar search box, so that user
Target search webpage is chosen from the search and webpage word bank of loading, realizes that search and webpage switches, and in the target search net of switching
Scanned in page.So, search and webpage switching flow is relatively simple so that realize search and webpage switching needed for time it is short,
Switching efficiency is higher, and by crucial words extractive technique, can switch search between different search engines more quickly,
Without re-entering crucial words every time;Meanwhile, before substantive search is carried out, it is only necessary to which user is defeated in current search webpage
Enter target search info web, without carrying out target search Webpage search by current search webpage, search flow will not be consumed,
Effectively save search flow;Further, when carrying out different search engines search by webpage, different search can be extracted and drawn
The search key word held up so that crucial words can be automatically updated according to the switching of the different search and webpage pages;Moreover, cutting
Different web pages page-tag is changed, if two Webpages are different search engines, current web page page correspondence are extracted and searches for
Crucial words, to realize that the crucial words in toolbar search box also changes therewith during switching Webpage;In addition, passing through
The crucial word list of addition search supplement, facilitates user's quick and precisely search key word, reduces user's input time, and pass through
The instant input of user, the crucial words of supplement of immediate feedback search, the crucial words of supplement that the search is obtained all is and user
Immediately the related best match of input, the related keyword that user most often searches for, user only need direct keypad upper lower key and
Enter key, you can quick supplement input and search.
Fig. 5 is the search switching device structural representation of the embodiment of the present invention.The search switching device is browser, bag
Include:Extraction module, load-on module and handover module, wherein,
Extraction module, the search information in searched page search box for obtaining current search webpage, extract described in search
The crucial words included in rope information, and the crucial words of extraction is exported into the toolbar search box of current search webpage;
In the embodiment of the present invention, extraction module includes:Split cells, removal unit and assembled unit (do not show in figure
Go out), wherein,
Split cells, for being split by participle cutting method to the search information of acquisition;
Removal unit, meaningless word removal is carried out for the words to cutting;
Assembled unit, for being combined to the words obtained after meaningless word removal processing, obtains crucial words.
As alternative embodiment, extraction module further comprises:
Decoding unit, the coded format for obtaining search information is carried out according to the coded format of acquisition to search information
Decoding.
As another alternative embodiment, extraction module further comprises:Computing unit and judge processing unit, wherein,
Computing unit, the term frequency-inverse document word frequency for calculating each crucial words extracted;
In the embodiment of the present invention, the formula for calculating the term frequency-inverse document word frequency value of crucial words can be as follows:
In formula,
TF is the word frequency of crucial words;
IDF is the inverse document word frequency of crucial words;
N' is the number of times that crucial words occurs in the search and webpage sample set pre-set;
N is the total quantity of each crucial words in search and webpage sample set;
D is total dragnet number of pages that crucial words is included in search and webpage sample set;
D' is to search for the total dragnet number of pages included in sample set;
+ 1 is smoothing processing.
Judge processing unit, whether the term frequency-inverse document word frequency value of the crucial words for judging to calculate is not less than in advance
The threshold value of setting, if it is, extracting the crucial words, otherwise, filters out the crucial words.
Load-on module, what the search key word pre-set for being loaded in the toolbar search box mapped searches
Rope webpage word bank;
In the embodiment of the present invention, load-on module includes:Query unit and Traversal Unit (not shown), wherein,
Query unit, for inquiring about the search and webpage storehouse pre-set, the search and webpage storehouse is by each search key word
The corresponding search and webpage word bank composition of mapping;
In the embodiment of the present invention, each search key word maps a search and webpage word bank, and multiple search key words reflect
The corresponding search and webpage word bank composition search and webpage storehouse penetrated.
Traversal Unit, for the search key word in traversal search web page library, obtains the crucial words of the extraction
The search key word matched somebody with somebody, loads the search and webpage word bank of the search key word mapping of the matching.
In the embodiment of the present invention, search and webpage word bank can be shown in control icons mode.So, by obtaining
The icon of the search and webpage word bank of mapping is stated, is shown search and webpage word bank icon as control and the crucial words of the extraction
In the toolbar search box.
As alternative embodiment, load-on module can further include:
Memory cell, for it is determined that not having the search key of the crucial words matching of the extraction in search and webpage storehouse
After word, the crucial words extracted is preserved, and build the mapping relations for the search and webpage that the crucial words of extraction is set with user.
In the embodiment of the present invention, crucial words is saved in the WebContentsImpl class related to the search and webpage page
In, in WebContentsImpl classes, SetSearchText () function is used to preserve crucial words, GetSearchText ()
Function is used to extract crucial words.
Handover module, receives the handover request of the crucial words in the toolbar search box, from the dragnet of loading
Target search webpage is read in page word bank, and switches to the target search webpage of reading to scan for.
In the embodiment of the present invention, the search and webpage word bank of loading shows each target search webpage in the way of drop-down menu.
As alternative embodiment, the search switching device may further include:Info web acquisition module and webpage
Judge module, wherein,
Info web acquisition module, for obtaining current web page information;
In the embodiment of the present invention, as alternative embodiment, info web acquisition module includes:Monitoring unit and webpage letter
Acquiring unit (not shown) is ceased, wherein,
Monitoring unit, WebContentsObserver class is inherited from for writing, and is monitored Webpage loading and is completed thing
Part;
Info web acquiring unit, for after Webpage loading completion event is listened to, obtaining the Webpage
Load the info web of completion event transmission.
Webpage judge module, it is determined that obtain current web page information be search and webpage information after, notify extraction module obtain
Take the search information in the searched page search box of current search webpage.
In the embodiment of the present invention, webpage judge module includes:Matching unit, judging unit and notification unit are (in figure not
Show), wherein,
Matching unit, for the current web page information of acquisition to be matched with the search and webpage information collection pre-set;
In the embodiment of the present invention, search and webpage information collection can also be loaded into caching in advance, be matched with effective lifting
Efficiency, reduces the time needed for matching.
Judging unit, if current web page information and any info web phase of search and webpage information concentration for obtaining
Match somebody with somebody, it is determined that the current web page information obtained is search and webpage information;
Notification unit, for after judging unit determines the current web page information obtained for search and webpage information, notifying to carry
Modulus block.
As alternative embodiment, the search switching device further comprises:Monitoring modular, comparison module and display module
(not shown), wherein,
Monitoring modular, for monitoring the search information that user inputs in toolbar search box, sequentially extracts user's input
Search information;
In the embodiment of the present invention, sequentially extracting the search information of user's input includes:
Monitor that user often inputs a character, extract the character of user input;Or,
According to the character length threshold value pre-set, after monitoring that user's input meets the character of character length threshold value,
Extract the character of user input.
Comparison module, for sequentially being compared the crucial word list of the search information of extraction and the supplement that pre-sets
Compared with the crucial words of supplement for the search information match for obtaining and extracting;
In the embodiment of the present invention, obtaining the crucial words of supplement of the search information match with extracting includes:
If there is the crucial words of supplement that can be in full matched with the search information of extraction in the crucial word list of supplement, obtain
The crucial words of supplement matched in full to the search information with extraction;Can be with carrying if be not present in the crucial word list of supplement
The crucial words of supplement that the search information taken is matched in full, then carry out fuzzy matching, obtain the search information fuzzy with extracting
The crucial words of supplement matched somebody with somebody;Or,
If the crucial words number of supplement matched in full with the search information of extraction in the crucial word list of supplement is less than pre-
The display number threshold value first set, carries out fuzzy matching, is met being matched in full with the search information of extraction for display number threshold value
With the crucial words of supplement of fuzzy matching.
Display module, for including the crucial words of obtained supplement in real time as drop-down list to search in the toolbar
In frame.
Algorithm and display be not inherently related to any certain computer, virtual system or miscellaneous equipment provided herein.
Various general-purpose systems can also be used together with based on teaching in this.As described above, construct required by this kind of system
Structure be obvious.In addition, the present invention is not also directed to any certain programmed language.It is understood that, it is possible to use it is various
Programming language realizes the content of invention described herein, and the description done above to language-specific is to disclose this hair
Bright preferred forms.
In the specification that this place is provided, numerous specific details are set forth.It is to be appreciated, however, that the implementation of the present invention
Example can be put into practice in the case of these no details.In some instances, known method, structure is not been shown in detail
And technology, so as not to obscure the understanding of this description.
Similarly, it will be appreciated that in order to simplify the disclosure and help to understand one or more of each inventive aspect, exist
Above in the description of the exemplary embodiment of the present invention, each feature of the invention is grouped together into single implementation sometimes
In example, figure or descriptions thereof.However, the method for the disclosure should be construed to reflect following intention:It is i.e. required to protect
The application claims of shield features more more than the feature being expressly recited in each claim.More precisely, such as following
Claims reflect as, inventive aspect is all features less than single embodiment disclosed above.Therefore,
Thus the claims for following embodiment are expressly incorporated in the embodiment, wherein each claim is in itself
All as the separate embodiments of the present invention.
Those skilled in the art, which are appreciated that, to be carried out adaptively to the module in the equipment in embodiment
Change and they are arranged in one or more equipment different from the embodiment.Can be the module or list in embodiment
Member or component be combined into a module or unit or component, and can be divided into addition multiple submodule or subelement or
Sub-component.In addition at least some in such feature and/or process or unit exclude each other, it can use any
Combination is disclosed to all features disclosed in this specification (including adjoint claim, summary and accompanying drawing) and so to appoint
Where all processes or unit of method or equipment are combined.Unless expressly stated otherwise, this specification (including adjoint power
Profit is required, summary and accompanying drawing) disclosed in each feature can or similar purpose identical, equivalent by offer alternative features come generation
Replace.
Although in addition, it will be appreciated by those of skill in the art that some embodiments described herein include other embodiments
In included some features rather than further feature, but the combination of the feature of be the same as Example does not mean in of the invention
Within the scope of and form different embodiments.For example, in the following claims, times of embodiment claimed
One of meaning mode can be used in any combination.
The present invention all parts embodiment can be realized with hardware, or with one or more processor run
Software module realize, or realized with combinations thereof.It will be understood by those of skill in the art that can use in practice
Microprocessor or digital signal processor (DSP) come realize in search switching device according to embodiments of the present invention some or
The some or all functions of person's whole part.The present invention is also implemented as perform method as described herein one
Divide or whole equipment or program of device (for example, computer program and computer program product).It is such to realize this hair
Bright program can be stored on a computer-readable medium, or can have the form of one or more signal.It is such
Signal can be downloaded from Internet site server and obtained, and either be provided or in any other form on carrier signal
There is provided.
It should be noted that the present invention will be described rather than limits the invention for above-described embodiment, and ability
Field technique personnel can design alternative embodiment without departing from the scope of the appended claims.In the claims,
Any reference symbol between bracket should not be configured to limitations on claims.Word "comprising" is not excluded the presence of not
Element or step listed in the claims.Word "a" or "an" before element does not exclude the presence of multiple such
Element.The present invention can be by means of including the hardware of some different elements and coming real by means of properly programmed computer
It is existing.In if the unit claim of equipment for drying is listed, several in these devices can be by same hardware branch
To embody.The use of word first, second, and third does not indicate that any order.These words can be explained and run after fame
Claim.
The invention discloses A1. one kind search switching methods, including:
The search information in the searched page search box of current search webpage is obtained, extracts what is included in the search information
Crucial words;
The crucial words of extraction is exported into the toolbar search box of current search webpage;
The search and webpage word bank of the search key word mapping pre-set is loaded in the toolbar search box;
The handover request of the crucial words in the toolbar search box is received, is read from the search and webpage word bank of loading
Target search webpage is taken, and switches to the target search webpage of reading to scan for.
A2. the method according to A1, methods described further comprises:
The search information that monitoring user inputs in toolbar search box, sequentially extracts the search information of user's input;
Sequentially the crucial word list of the search information of extraction and the supplement that pre-sets is compared, obtains and extract
Search for the crucial words of supplement of information match;
The crucial words of obtained supplement is included in the toolbar search box in real time as drop-down list.
A3. the method according to A2, the search information for sequentially extracting user's input includes:
Monitor that user often inputs a character, extract the character of user input;Or,
According to the character length threshold value pre-set, after monitoring that user's input meets the character of character length threshold value,
Extract the character of user input.So, the change frequency of the follow-up crucial words of supplement shown to user can effectively be reduced.
A4. the method according to A2, described to obtain including with the crucial words of supplement of the search information match of extraction:
If there is the crucial words of supplement that can be in full matched with the search information of extraction in the crucial word list of supplement, obtain
The crucial words of supplement matched in full to the search information with extraction;Can be with carrying if be not present in the crucial word list of supplement
The crucial words of supplement that the search information taken is matched in full, then carry out fuzzy matching, obtain the search information fuzzy with extracting
The crucial words of supplement matched somebody with somebody.
A5. the method according to A2, described to obtain including with the crucial words of supplement of the search information match of extraction:
If the crucial words number of supplement matched in full with the search information of extraction in the crucial word list of supplement is less than pre-
The display number threshold value first set, carries out fuzzy matching, is met being matched in full with the search information of extraction for display number threshold value
With the crucial words of supplement of fuzzy matching.
A6. the method according to A1, methods described further comprises:
TabStripModel::ActivateTabAt initiates Webpage switching, is used to monitor webpage to browser window
The SearchRequestObserver classes of page layout switch message, which are sent, notifies ActiveTabChanged events;
Browser window notifies browser class after notice ActiveTabChanged events are received;
Webpage handover request is transmitted to browser toolbar class by browser class;
In ToolbarView::In Update functions, add the renewal to toolbar search box and operate;
Toolbar search box passes through the GetSearchText of WebContentsImpl classes according to the Webpage after switching
() function obtains the search key word of the Webpage mapping after the switching;
Whether the search key word for judging the mapping of the Webpage after the switching is empty, if crucial words is not
In sky, then the toolbar search box for the Webpage being substituted into after switching, if sky, then do not process.
A7. the method according to A1 to any one of A6, the crucial words searched for and included in information is extracted described
Before, methods described further comprises:
The coded format of search information is obtained, search information is decoded according to the coded format of acquisition.
A8. the method according to A1 to any one of A6, in the searched page search box of the acquisition current search webpage
In search information before, methods described further comprises:
Obtain current web page information;
After it is determined that the current web page information obtained is search and webpage information, performs the current search webpage of obtaining and search
The flow of search information in rope page search box.
A9. the method according to A8, the acquisition current web page information includes:
The class for being inherited from WebContentsObserver is write, Webpage loading completion event is monitored;
After Webpage loading completion event is listened to, the webpage of the Webpage loading completion event transmission is obtained
Information.
A10. the method according to A8, the current web page information that the determination is obtained includes for search and webpage information:
The current web page information of acquisition is matched with the search and webpage information collection pre-set;
If the current web page information obtained concentrates any info web to match with search and webpage information, it is determined that obtain
Current web page information is search and webpage information.
A11. the method according to A10, methods described further comprises:
The search and webpage information collection is loaded previously into caching.
A12. the method according to A1 to any one of A6, this that pre-set is loaded in the toolbar search box and is searched
The search and webpage word bank of Suo Guanjian words mapping includes:
Inquire about the search and webpage storehouse pre-set, the corresponding search that the search and webpage storehouse is mapped by each search key word
Webpage word bank is constituted;
Search key word in traversal search web page library, obtains the search key of the crucial words matching of the extraction
Word, loads the search and webpage word bank of the search key word mapping of the matching.
A13. the method according to A12, the search and webpage word bank is shown in control icons mode, described to add
Carry after search and webpage word bank, methods described further comprises:
The icon of the search and webpage word bank of the mapping is obtained, is extracted search and webpage word bank icon as control with described
Crucial words be shown in the toolbar search box.
A14. the method according to A12, methods described further comprises:
Determine there is no the search key word of the crucial words matching of the extraction in search and webpage storehouse, preserve the pass extracted
Key words, and build the mapping relations for the search and webpage that the crucial words of extraction is set with user.
B15. a kind of to search for switching device, the device includes:Extraction module, load-on module and handover module, wherein,
Extraction module, the search information in searched page search box for obtaining current search webpage, extract described in search
The crucial words included in rope information, and the crucial words of extraction is exported into the toolbar search box of current search webpage;
Load-on module, what the search key word pre-set for being loaded in the toolbar search box mapped searches
Rope webpage word bank;
Handover module, receives the handover request of the crucial words in the toolbar search box, from the dragnet of loading
Target search webpage is read in page word bank, and switches to the target search webpage of reading to scan for.
B16. the device according to B15, the extraction module includes:Split cells, removal unit and assembled unit,
Wherein,
Split cells, for being split by participle cutting method to the search information of acquisition;
Removal unit, meaningless word removal is carried out for the words to cutting;
Assembled unit, for being combined to the words obtained after meaningless word removal processing, obtains crucial words.
B17. the device according to B16, the extraction module further comprises:
Decoding unit, the coded format for obtaining search information is carried out according to the coded format of acquisition to search information
Decoding.
B18. the device according to B16, the extraction module further comprises:Computing unit and judgement processing are single
Member, wherein,
Computing unit, the term frequency-inverse document word frequency for calculating each crucial words extracted;
Judge processing unit, whether the term frequency-inverse document word frequency value of the crucial words for judging to calculate is not less than in advance
The threshold value of setting, if it is, extracting the crucial words, otherwise, filters out the crucial words.
B19. the device according to B15, the load-on module includes:Query unit and Traversal Unit, wherein,
Query unit, for inquiring about the search and webpage storehouse pre-set, the search and webpage storehouse is by each search key word
The corresponding search and webpage word bank composition of mapping;
Traversal Unit, for the search key word in traversal search web page library, obtains the crucial words of the extraction
The search key word matched somebody with somebody, loads the search and webpage word bank of the search key word mapping of the matching.
B20. the device according to B19, the load-on module further comprises:
Memory cell, for it is determined that not having the search key of the crucial words matching of the extraction in search and webpage storehouse
After word, the crucial words extracted is preserved, and build the mapping relations for the search and webpage that the crucial words of extraction is set with user.
B21. the device according to B15 to any one of B20, further comprises:Info web acquisition module and webpage
Judge module, wherein,
Info web acquisition module, for obtaining current web page information;
Webpage judge module, it is determined that obtain current web page information be search and webpage information after, notify extraction module obtain
Take the search information in the searched page search box of current search webpage.
B22. the device according to B21, the info web acquisition module includes:Monitoring unit and info web are obtained
Unit is taken, wherein,
Monitoring unit, WebContentsObserver class is inherited from for writing, and is monitored Webpage loading and is completed thing
Part;
Info web acquiring unit, for after Webpage loading completion event is listened to, obtaining the Webpage
Load the info web of completion event transmission.
Webpage judge module, it is determined that obtain current web page information be search and webpage information after, notify extraction module obtain
Take the search information in the searched page search box of current search webpage.
B23. the device according to B21, the webpage judge module includes:Matching unit, judging unit and notice
Unit, wherein,
Matching unit, for the current web page information of acquisition to be matched with the search and webpage information collection pre-set;
Judging unit, if current web page information and any info web phase of search and webpage information concentration for obtaining
Match somebody with somebody, it is determined that the current web page information obtained is search and webpage information;
Notification unit, for after judging unit determines the current web page information obtained for search and webpage information, notifying to carry
Modulus block.
B24. the device according to B15 to any one of B20, further comprises:Monitoring modular, comparison module and display
Module, wherein,
Monitoring modular, for monitoring the search information that user inputs in toolbar search box, sequentially extracts user's input
Search information;
Comparison module, for sequentially being compared the crucial word list of the search information of extraction and the supplement that pre-sets
Compared with the crucial words of supplement for the search information match for obtaining and extracting;
Display module, for including the crucial words of obtained supplement in real time as drop-down list to search in the toolbar
In frame.