Embodiment
It is specifically real below in conjunction with the application to make the purpose, technical scheme and advantage of the application clearer
Apply example and technical scheme is clearly and completely described corresponding accompanying drawing.Obviously, it is described
Embodiment is only some embodiments of the present application, rather than whole embodiments.Based on the implementation in the application
Example, the every other implementation that those of ordinary skill in the art are obtained under the premise of creative work is not made
Example, belongs to the scope of the application protection.
The process that Fig. 1 sets up for the index that the embodiment of the present application is provided, specifically includes following steps:
S101:Determine each data that lithol yet to be built draws.
In actual applications, in order to allowing user more efficiently to find required data, it usually needs
According to the data stored in database, the corresponding index of data is set up in index database, and index database is externally carried
Supply user.
In the embodiment of the present application, the system that whole index is set up, as shown in Figure 2.
Further, set up for data during the entire process of index, the application determines that lithol yet to be built draws first
Each data, and determine that each data that lithol yet to be built draws are completed by the index manager shown in Fig. 2.
Which data index is set up on earth because index manager needs to know, therefore, in this application,
The corresponding index information table of all data can be extracted by index manager, it is determined that each index information extracted
The Index Status included in table, by the data that Index Status is state to be indexed or status of fail, as yet to be built
The data that lithol draws.
At this it should be noted that index information table is stored in the index information Table storehouse in Fig. 2, each data
To one index information table of reply, the Index Status of data, different ropes are have recorded in the index information table
Draw state and reflect the situation that index is set up for data, three kinds of Index Status can be divided into, i.e. shape to be indexed
State, success status, status of fail, that is to say, that the index information table pair is able to know that by Index Status
Whether the data answered establish index in index database, also, in order to reduce depositing for index information Table storehouse
Store up pressure, therefore, the mark of data is have recorded in index information table, subsequently, index manager can for this
When corresponding data are indexed in index information table, directly found according to the mark of data in database
Data.
For example, it is assumed that the internal staff for convenience of certain enterprise conveniently obtains the industry of enterprises
Business data, then establish index database and be supplied to internal staff, in order to the simple clearly explanation present invention's
Implementation steps, it is assumed that only include index information table as shown in table 1 in index information Table storehouse:
Table 1
Index information table as shown in table 1, is extracted in table 1 in index manager scanning index information Table storehouse
Comprising state to be indexed (that is, Index Status), and using the business datum A of state to be indexed as yet to be built
The data that lithol draws, and perform step S102.
S102:Determine the data type of each data.
S103:According to the data type of each data, the priority of each data is determined.
Because in actual applications, data are typically to have type, e.g., and each data correspond to different industry
Service type, and different types of data are made a difference point, also have real-time point, therefore,
, can be real by data according to importance in order to reduce the pressure that index database sets up index for data in the application
When property distinguishes priority, that is to say, that the data priority that importance is higher, real-time is higher is just high,
The data priority that importance is relatively low, real-time is relatively low is just relatively low, and in this application, can using P0,
P1, P2 ... Pn mode represent priority, wherein, n is bigger, illustrate that priority is lower.
In addition, it is determined that each data priority when, each data can not also be determined according to the type of data
Priority, e.g., can manually set the priority of each data, subsequently, Sync Manager previously according to experience
The priority of default each data can directly be determined.
Therefore, Sync Manager is after each data that lithol yet to be built draws are determined, it may be determined that the data of each data
Type, and according to the data type of each data, determine the priority of each data.
Continuation of the previous cases, it is assumed that Sync Manager determines business datum A data type, and according to the data
Type, determines business datum A priority for P1, that is, priority as shown in table 1.
S104:According to the priority of each data, it is defined as the time that each data set up index.
In this application, the priority of each data is different, then the time that index is set up for the data is just different,
That is, for any two data, if the priority of two data is different, being set up for two data
The time of index is also different.
Therefore, in this application, Sync Manager is after the priority of each data is determined, index manager
Need the priority according to each data different, be defined as the time that each data set up index, and the application exists
This provides a kind of mode for the time for determining each data foundation index:It is corresponding according to default each priority
In the cycle, it is defined as each data and sets up the index corresponding cycle, the corresponding cycle is indexed according to being set up for each data
And current time, it is defined as the time that each data set up index, that is to say, that each data are corresponding is
The time that the data set up index is on the basis of current time, to add the priority corresponding cycle, wherein,
For any two data, if the priority of two data is different, index is set up for two data corresponding
Cycle is also different.
Continuation of the previous cases, it is assumed that P0 cycle is 0 minute, P1 cycle is 1 minute, and P2 cycle is 2
Minute ... Pn cycle is n minutes, poor 1 minute between two neighboring priority, therefore, management by synchronization
Device is after business datum A priority P 1 is determined, it is assumed that current time is 12:10, then index manager
According to business datum A priority P 1, the time for being defined as business datum A foundation indexes is 12:11.
S105:For each data, it is determined that the time for setting up index for the data reach when, for this
Data set up index.
In this application, for having confirmed each data of priority, when set up for the data index when
Between when reaching, index manager can be according to the Data Identification in the corresponding index information table of the data, from data
The corresponding data of the Data Identification are inquired in storehouse, and are sent the data in index database, index database is should
Data set up index.
Further, since in actual applications, different types of data are when setting up index, and the mode of foundation is led to
It is often different, the code difference of the index process instrument for setting up index is being write so as to result in,
If that is, increasing the data of a data type newly, needing to write the generation of index process instrument again
Code, therefore, when setting up index for data, can be directed to different types of data, using different indexes
Processor sets up index, so, even if subsequently newly increasing a type of data, it is only necessary to for the type
Data, increase newly an index processor, the code of original index processor without changing.
Herein it should be noted that index processor can be IndexHandler as shown in Figure 2, for
Different types of data, can create different IndexHandler, subsequently, can will be variant
IndexHandler is commonly connected in task distributor as shown in Figure 2, and work as needs to set up for data every time
During index, bottom can be determined to by the task distributor needs come for the number by which IndexHandler
Indexed according to setting up.
Continuation of the previous cases, index manager is determining that for the time of business datum A foundation indexes be 12:After 11,
It is 12 until index manager current queries go out current time:11, i.e. it is determined that for business datum A
When the time for setting up index reaches, index manager uses the corresponding index process instruments of business datum A, root
According to the business datum A and user A in index information table, inquire business datum A's in database
Total data, index database is sent to by business datum A total data, and index database is business datum A's
Total data sets up index.
By the above method, there are substantial amounts of data in database while when updating, by preferential
Each data are set up and indexed by the mode of level in index database respectively according to the different time, effectively reduce rope
Draw the operating pressure in storehouse.
Because in actual applications, more news occurs in the data in database, i.e. occur it is newly-increased,
Change, situation about deleting, therefore, in this application, are regularly supervised by the Sync Manager shown in Fig. 2
The change of data in database is surveyed, specifically, for any data in database, passing through Sync Manager
Whether the data corresponding final updating time in monitor database exceedes the corresponding index information of the data
The final updating time included in table, when monitor the corresponding final updating time of the data in database surpass
When spending the final updating time included in the corresponding index information table of the data, if the data are in corresponding rope
Draw in information table and be not present, then increase the data newly in index information table and the Index Status of the data is set
It is directly that the data are corresponding if the data are already present in index information table for state to be indexed
Index Status in index information table is changed to state to be indexed.
For example, in Sync Manager monitor database data change, it is assumed that the data B in database is
Exist in index information table, and 120:00 is updated, and now Sync Manager monitors B pairs of data
The final updating time 12 answered:00 has exceeded the final updating included in the corresponding index information tables of data B
Time 11:50, therefore, the Index Status in the corresponding index information tables of data B is changed to be indexed
State.
In view of in practical application, in order to be easy to follow-up management and inquiry to set up the situation of index for data,
Therefore, in this application, the data drawn for any lithol yet to be built, when setting up index failure for the data,
Index Status in the corresponding index information table of the data is changed to by status of fail by Sync Manager, and
And the frequency of failure included in the corresponding index information table of the data plus 1, indexed into when being set up for the data
During work(, the Index Status in the corresponding index information table of the data is changed to successfully by shape by Sync Manager
State, and the frequency of failure included in the corresponding index information table of the data is set to 0, when data correspondence
Index information table in Index Status be status of fail, and the frequency of failure exceed default threshold value when, not for
The data set up index.
Herein it should be noted that the data drawn for any lithol yet to be built, lose when setting up index for the data
Lose, but the frequency of failure is when being not above default threshold value, can be by index manager according to the excellent of the data
The first level corresponding cycle, it is determined that the time for setting up index again for the data (e.g., can directly be before
When the data set up index failure on the basis of the corresponding moment, the priority directly plus the data is corresponding
A cycle), and when being that the data set up the time arrival of index again, set up and index for the data.
Continue the example in step S105, index manager sets up rope in the total data for business datum A
During drawing, it may cause to set up index failure because system is unstable, then by business datum A correspondences
Index information table in Index Status be changed to status of fail, and the corresponding indexes of business datum A are believed
The frequency of failure included in breath table plus 1, as shown in table 2:
Table 2
Subsequently, index manager is determined is not above for the business datum A frequency of failures for setting up index failure
3 times (assuming that default threshold value is 3 times), according to the business datum A priority corresponding cycle, i.e. 1
Minute, it is determined that the time for being again business datum A foundation indexes is 12:12 (assuming that using mentioned above
It is determined that the mode of the time of index is set up for the data again), the time of index is being set up for business datum A
During arrival, i.e. 12:12, index is set up for business datum A total data again, and successfully set up
Index, then be changed to success status by the Index Status in the corresponding index information tables of business datum A,
And the frequency of failure included in the corresponding index information tables of business datum A is set to 0, as shown in table 3:
Table 3
In addition, the data drawn for any lithol yet to be built, when setting up index failure for the data, Ke Yi
The reason for index failure is set up in addition in the corresponding index information table of the data, subsequently, can believe according to the index
The reason for ceasing the foundation index failure in table, takes appropriate measures and is lost to prevent from occurring again such index
Lose.
In actual applications, it is possible to which certain data existed in database are deleted, and are also existed in index database
The situation of the data, therefore, in this application, can be determined to be deleted in database by Sync Manager
Each data, according to each data to be deleted determined, by Sync Manager by each data to be deleted
Corresponding index information table is marked, subsequently, and the index information table pair of mark is determined by index manager
The index for the data answered, the index determined is marked, and index database can be swept at set time intervals
The markd index of tool is retouched, and the markd index of the tool scanned is deleted, rope is reduced so as to effective
Draw the peak pressure in storehouse.
For example, it is assumed that database deletes data A, now Sync Manager starts scan database,
Business datum A to be deleted is determined, and according to business datum A to be deleted is determined, directly treats and deletes
The corresponding index information tables of business datum A removed are marked, as shown in table 4:
Table 4
Index manager determines the corresponding business datum A's of index information table (that is, table 4) in index database
Index, the index determined is marked, subsequently, index database can scan tool at set time intervals
Markd index, and the markd index of the tool scanned is deleted.
Herein it should be noted that why using above by the corresponding index information table of each data to be deleted
The mode being marked, is primarily due in order to which the system do not set up to whole index increases extra operation pressure
Power, is simply marked to the index determined in index database, represents that the data have been deleted in index database
Remove, but be not really to delete, simply user is when searching for the data related to the data, Bu Huixiang
User provides the data.
The method set up above for a kind of index that the embodiment of the present application is provided, based on same thinking, this Shen
Please embodiment additionally provide it is a kind of index set up device, as shown in Figure 3.
The apparatus structure schematic diagram that Fig. 3 sets up for the index that the embodiment of the present application is provided, described device includes:
Data determining module 301, for determining each data that lithol yet to be built draws;
Data type determining module 302, the data type for determining each data;
Priority Determination module 303, for the data type according to each data, determines the excellent of each data
First level;
Index time determining module 304, for the priority according to each data, is defined as each number
According to the time for setting up index, wherein, for any two data, if the priority of two data is different,
The time for setting up index for two data is also different;
Index sets up module 305, for for each data, it is determined that set up index for the data
When time reaches, set up and index for the data.
The data determining module 301 by index manager specifically for extracting the corresponding rope of all data
Draw information table, it is determined that the Index Status included in each index information table extracted, is to be indexed by Index Status
The data of state or status of fail, the data drawn as lithol yet to be built.
Described device also includes:
Monitoring modular 306, for for any data in database, passing through Sync Manager Monitoring Data
Whether the data corresponding final updating time in storehouse exceedes includes in the corresponding index information table of the data
The final updating time, when monitor the corresponding final updating time of the data in database exceed the data
During the final updating time included in corresponding index information table, if the data are in corresponding index information table
In be not present, then increase newly and the data and be set to the Index Status of the data to be indexed in index information table
State, if the data are already present in index information table, directly by the corresponding index information of the data
Index Status in table is changed to state to be indexed.
The index time determining module 304 specifically for, according to the default each priority corresponding cycle,
It is defined as each data and sets up the index corresponding cycle, wherein, for any two data, if two numbers
According to priority it is different, then the index corresponding cycle is set up for two data also different, according to for each number
Corresponding cycle and current time are indexed according to setting up, is defined as the time that each data set up index.
Described device also includes:
Index Status changes module 307, for the data drawn for any lithol yet to be built, is built when for the data
When lithol draws unsuccessfully, the Index Status in the corresponding index information table of the data is changed by Sync Manager
For status of fail, and the frequency of failure included in the corresponding index information table of the data plus 1, when for this
Data are set up when indexing successfully, by Sync Manager by the index shape in the corresponding index information table of the data
State is changed to success status, and the frequency of failure included in the corresponding index information table of the data is set into 0,
When the Index Status in the corresponding index information table of the data be status of fail, and the frequency of failure exceed it is default
During threshold value, do not set up and index for the data.
Described device also includes:
Reason add module 308, when setting up module 305 for the index for data foundation index failure,
The reason for index failure is set up in addition in the corresponding index information table of the data.
Described device also includes:
Removing module 309, for determining each data to be deleted in database by Sync Manager, according to
Each data to be deleted determined, by Sync Manager by the corresponding index information of each data to be deleted
Table is marked, and the index of the corresponding data of index information table of mark is determined by index manager, to true
The index made is marked, the markd index of scanning tool, and scanning at set time intervals
Tool it is markd index delete.
The index sets up module 305 specifically for for different types of data, using different indexes
Handling implement sets up index.
In a typical configuration, computing device includes one or more processors (CPU), input/defeated
Outgoing interface, network interface and internal memory.
Internal memory potentially includes the volatile memory in computer-readable medium, random access memory
And/or the form, such as read-only storage (ROM) or flash memory (flash RAM) such as Nonvolatile memory (RAM).
Internal memory is the example of computer-readable medium.
Computer-readable medium includes permanent and non-permanent, removable and non-removable media can be by appointing
What method or technique realizes that information is stored.Information can be computer-readable instruction, data structure, program
Module or other data.The example of the storage medium of computer include, but are not limited to phase transition internal memory (PRAM),
Static RAM (SRAM), dynamic random access memory (DRAM), it is other kinds of with
Machine access memory (RAM), read-only storage (ROM), Electrically Erasable Read Only Memory
(EEPROM), fast flash memory bank or other memory techniques, read-only optical disc read-only storage (CD-ROM),
Digital versatile disc (DVD) or other optical storages, magnetic cassette tape, tape magnetic rigid disk are stored or it
His magnetic storage apparatus or any other non-transmission medium, the letter that can be accessed by a computing device available for storage
Breath.Defined according to herein, computer-readable medium does not include temporary computer readable media (transitory
Media), such as the data-signal and carrier wave of modulation.
It should also be noted that, term " comprising ", "comprising" or its any other variant are intended to non-row
His property is included, so that process, method, commodity or equipment including a series of key elements not only include
Those key elements, but also other key elements including being not expressly set out, or also include for this process,
Method, commodity or the intrinsic key element of equipment.In the absence of more restrictions, by sentence " including
One ... " key element that limits, it is not excluded that in the process including the key element, method, commodity or set
Also there is other identical element in standby.
It will be understood by those skilled in the art that embodiments herein can be provided as method, system or computer journey
Sequence product.Therefore, the application can using complete hardware embodiment, complete software embodiment or combine software and
The form of the embodiment of hardware aspect.Moreover, the application can be used wherein includes calculating one or more
Machine usable program code computer-usable storage medium (include but is not limited to magnetic disk storage, CD-ROM,
Optical memory etc.) on the form of computer program product implemented.
Embodiments herein is the foregoing is only, the application is not limited to.For this area skill
For art personnel, the application can have various modifications and variations.All institutes within spirit herein and principle
Any modification, equivalent substitution and improvements of work etc., should be included within the scope of claims hereof.