Planning Motivation Control

1c setting up full-text search. Full text search engine (1Cv8). Full-text search engine

Until now, few people know that, starting with version 8.1, the 1C: Enterprise platform has a wonderful and very useful mechanism - full-text search. What it is? How can it be useful for you? These questions are answered in the article by V.V. Fishing, 1C company.

To begin with, a few words about what kind of mechanism it is. Full text search by saying simple language, allows you to find text information placed almost anywhere in the configuration used. At the same time, you can search for the necessary data either throughout the entire configuration as a whole, or by narrowing the search area to several objects (for example, certain types of documents or directories). The search criteria themselves can vary over a fairly wide range. That is, you can find the data you need without even remembering exactly where it is stored in the configuration and how it is written.

Full-text search provides the following capabilities.

  1. There is support for transliteration (writing Russian words in Latin characters in accordance with GOST 7.79-2000). Example: "Russian phrase" = "Russian fraza".
  2. There is support for substitution (writing part of the characters in Russian words with single-key Latin characters). Example: "russrfz phpf" (the endings of each word are typed in Latin, for example, as a result of an operator error).
  3. There is a possibility of a fuzzy search (the letters in the found words may differ) with an indication of the fuzzy threshold. Example: by specifying the word "hello" and the fuzziness of 17% in the search line, we will find all similar words with and without errors: "hello", "hello", "give".
  4. It is possible to specify the scope of the search for the selected metadata objects.
  5. Full-text indexing of the names of standard fields ("Code", "Name", etc.) is performed in all configuration languages.
  6. The search is performed taking into account the synonyms of the Russian, English and Ukrainian languages.
  7. The morphological dictionary of the Russian language contains a number of specific words related to the areas of activity automated using the 1C: Enterprise software system.
  8. As a standard, the supplied dictionaries include dictionary databases and dictionaries of the thesaurus and synonyms of Russian, Ukrainian and English languages, which are provided by the "Informatic" company.
  9. You can search using wildcards ("*"), as well as specifying search operators ("AND", "OR", "NOT", "NEXT") and special characters.

Full-text search can be performed in any configuration on the 1C: Enterprise 8.1 platform.

This also applies to configurations that were converted from version 8.0. To enable full-text search capabilities, just go to the "Operations" menu of your configuration and select the "Full-text search management" item, and then enable this feature (see Fig. 1).

Rice. 1

If you are using typical configurations on the 8.1 platform, then, most likely, they already have built-in processing "Search for data" (menu "Tools" / "Search for data"). If such processing is absent in the used configuration, it does not matter.

It can always be found on the ITS disk. In this article, we will use examples of how this particular processing works in the demo configuration "Enterprise Accounting" (rev. 1.6) to demonstrate the capabilities of full-text search.

As already mentioned, the search can be carried out by several words, using search operators and by the exact phrase. In addition, the search location can be limited to specific configuration objects (eg Manufacturing Services Act documents) or a list / set of configuration objects.

When searching for data, it is allowed to use search operators in the search string (all operators must be specified only in CAPITAL letters and without quotes) indicated in the table.

table


Please note: if no operators are specified (words are separated by a space), the program searches for all words from the query using the "AND" operator.

Rice. 2 shows an example of a simple search on a part of a word. Typing "hope *", as a result, we got a link to individual, as well as documents containing the phrase "Trusted customer" in the comments.


Rice. 2

Rice. 3 demonstrates an example of a more complex search using the "OR" construction in the search string and limiting the search area according to the "Nomenclature" directory and the documents "Receipt of goods and services", "Sale of goods and services". It is clearly seen that the search reflected the entire nomenclature, in the names of which there is either the word "teapot" or the word "BINATONE", as well as all documents of the specified types containing all the appropriate nomenclature.


Despite the fact that full-text search on the 8.3 platform was announced by the developers a long time ago (from the 8.3.5 platform), it was not actively used in typical configurations. In the latest releases of Enterprise Accounting 3.0, developers have included full-text search in many of the lists. It was a shock for my users - the program stopped searching.

Of course, full-text search works, but users are confused not seeing the "Find" window. Typical usage scenario: Start typing, while typing, the "Find" window appears, which indicates the field in which the search will be performed, the search text and the search mode "By part of string".

By pressing the enter button, the list is filtered, and the search status bar appears above the list. The user himself determines in which field and what he is looking for. The new search starts working as soon as you type and affects all fields displayed in the list. A separate window does not appear, all matches of search words are highlighted in color.

For several days we lived with a new search. Users suffered, complained, sabotaged. Complaints did not stop, the management set the task "to do everything as it was."

Where to begin? You need to understand how the forms differ from each other. Dumped the configuration sources with the new search behavior and the old one, and compared the form sources.

The functionality of the new full-text search is provided by the addition of a form element with the "Search string" type. It became clear what to look for. Found an article on ITS 7.3.1.5. Search in a dynamic list. The study of this article led to the conclusion that the new version of the search operation depends on two factors: 1. The form must have the above addition of the form element, 2. The dynamic list on the form must have the "SearchString Position" property not equal to "None".

In theory, when creating a form on the server, it is enough to set the "SearchStringPosition" list property to "SearchStringPosition.No", but this did not work with all forms, in some cases the new search continued to work. We cannot programmatically delete form elements that have not been created programmatically, but we can control the visibility. If the visibility is removed for the "SearchStringAddition" form element, the new full-text search also stops working. During the experiments, the following code was born, which I placed in the common module:

Procedure DisableNewSearchVSLists (Form) Export List = Form.Elements.Find ("List"); If List = Undefined Then Return; EndIf; List.SearchStringPosition = SearchStringPosition.No; AppendixSearchString = Form.Elements.Find ("AppendixSearchString"); If NOT AdditionSearchString = Undefined Then AdditionSearchString.Visibility = False; EndIf; End of Procedure

In the procedure "DisableNewSearchVSLists" you need to transfer the form to be corrected. But how can you do this for all forms at once?

The first solution is to manually fix the required forms in the configurator using the form editor. I immediately refused this solution - it is long and dreary, and it is difficult to update the configuration later.

The second solution is to call a procedure when the form is opened, which will programmatically disable the new search. The procedure can be called from any other procedure, the launch of which is already registered in all forms, in this case, with further updates, we will only need to monitor this procedure so that it does not change. I selected Common Module.Print Management, which has:

OnCreateOnServer (Form, CommandDefault Place, Print Objects) Export

This procedure is called when a form is created on the server to fill out print commands. In this procedure, we write the code that calls our function to disable new search in lists:

MySharedModule.Disable NewListSearch (Form);

Accountants are enjoying the old search, and we are preparing for the moment when Enterprise Accounting 3.0 compatibility mode will allow us to bring this functionality into an extension.

Tip 1: Disable Full Text Search *

Most accountants do not know about the existence of this function and never use it (Service - Data Search)

The mechanism of full-text search in 1C allows you to find information in 1C by keywords (by analogy with searching on the Internet, when you enter a word and you are given the results of queries). At the same time, the search time significantly depends on the volume of the database and can take several hours. Disabling the full-text search mechanism does not affect other functions and stability of work in 1C.

The full-text search mechanism in 1C is enabled by default. To turn off full-text search, you need to go Operations - Full-text search management-Adjustment and remove the sign " Allow full text search»

Disabling the full-text search mechanism is carried out in exclusive mode (no one should work in the program except you) **

Disabling the full-text search engine provides a performance improvement of up to 10%.

Tip 2: Recalculate totals *

Most accountants are not aware of the existence of this operation, and it must be performed every month.

Results are 1C mechanisms for quick access to data when generating reports and performing various computational operations.

In order to recalculate totals, you need to go to Operations - Manage totals, set the date by which to calculate totals (the beginning of the current month) in the "All registers" section and click the "Execute" button

Recalculation of totals is carried out in exclusive mode (no one should work in the program, except you) **

The recalculation of the totals gives an increase in productivity of up to 10%.

Tip 3: Disable Object Versioning ***

Most accountants are unaware of this feature and do not use it.

Unlike a standard logbook, object versioning will allow you to store information not only about which user worked with the document, but also what exactly he changed (Service - Object change history). This mode can be useful, but it is recommended to enable it only for a specific list of documents, because it leads to a decrease in the performance of 1C and an increase in the information base

Setting up versioning is carried out through Operations - Program settings - Versioning. If the setting is not required, then you need to remove the flag "Use object versioning".

If the setting is needed for a certain list of documents, then go to the "Object versioning settings" and right-click to set the "Versioning" setting for the required objects **

Disabling versioning gives a performance increase of up to 5%.

_________________________________________________________________

* For configurations based on "1C: Management Manufacturing enterprise"," 1C: Integrated Automation "," 1C: Enterprise Accounting 2.0 "," 1C: Trade Management 10.3 "

** Before performing routine operations with the database, it is necessary to create a copy of the database.

*** For configurations based on "1C: Manufacturing Enterprise Management", "1C: Integrated Automation".

Full-text search engine in 1C allows you to quickly find the information necessary for the user. This view search is especially effective if the information base has a large amount of information, and it is also not known exactly where the data of interest to the user is located or, as often happens, their exact name is not known. In order to open the full-text search control window, do the following: menu item Operations Full-text search management .

In this window, you can see three buttons: Customization - Enable / Disable full-text search;

Update index Index creation / Index update; Clear index - zeroing the index (recommended after updating all data); paragraph Allow merging indexes responsible for merging the primary and secondary index.

Full-text search is performed using the full-text index. In the absence of an index, full-text search as such is not possible. For a search to be successful, all the data required must be included in the full-text index. If the user has entered new data into the database, they should be included in the index in question, otherwise they will not participate in the search. To avoid this, the full-text index must be updated. When updating, the system only analyzes certain types of data: String, Reference Data (links to documents, reference books), Number, Date, Storage. If the user does not have access rights to certain information, then he will not be able to see it in the search results. It should also be remembered that the value Full Text Search - Use which is set by default.

As you can see the property Use installed for the entire directory RegNumbers , but this can be done for each of its attributes of the corresponding type.

Let's take a closer look at the full-text index, which consists of two parts (indexes): main index and additional ... The main index provides a high speed of data search, but its updating is relatively slow, depending on the amount of data. The additional index is opposite to it. Data is added to it much faster, but searches are slower. The system searches simultaneously in both indexes. Most of the data is in the main index, and the data added to the system goes into the secondary index. While the amount of data in the secondary index is small, searches on it are relatively fast. At a time when the load on the system is light, an index merge operation occurs, as a result of which the secondary index is flushed, and all data is placed in the main index. It is preferable to merge indexes at a time when the load on the system is minimal. For this purpose, you can create scheduled tasks and tasks on a schedule.

Consider the case of an automatic update of the index when the application starts. This case is suitable for single-user databases (products such as 1C Basic accounting, 1C Simplified), since with a large number of users, the update will occur after the launch of the application of each of the users, which, as a result, will greatly affect the system performance.

First, let's create common module and let's call it, for example PP. We will write the following procedure in it:

Procedure Updating Indexes () Export

FulltextSearch.UpdateIndex ();

End of Procedure

Let's set the properties as in the picture.

Then right-click on the configuration name in the configuration tree and execute the command Open a module of a managed application. Select a predefined function in the small window at the top BeforeStartingSystem and put the following line in this procedure:

UpdateFullTextSearch.UpdateIndices ();


We save the changes made. Thus, after each launch of the application, the index will be updated automatically.

Now let's consider the case when there are several users. Here we will use Regular Tasks ( in the Configurator mode: in the configuration tree - General - Routine Tasks). In this case, we are only interested in two tasks: Updating the Full-TextSearch Index and Merging the Full-TextSearch Index. In the properties of these tasks, select Schedule and click on the link Open.

We set up the schedules for both tasks. There are no recommendations for setting in this case, here the setting is determined based on the characteristics of the system (load, amount of information, frequency of its updating, etc.). The tasks themselves will not work, we need to have a running session of the program in the mode Enterprises, who will be responsible for completing these tasks. It should be noted right away that this option is used for the file system. Wait processing must be running in this session by invoking an embedded language method. This processing will look like this:

Let's switch to the Enterprise mode and do the following: Let's start our processing, which in this case will be called every 5 seconds and, in turn, calls the “ExecuteJobsProcessing ()” method. This method checks if it is time to carry out tasks according to their schedule. Next, go to the menu item Operations - Constants - Program settings - Data Exchange tab.

Let's define a user session that will be responsible for execution and set the polling interval for scheduled jobs. It is not recommended to work in this session, as it may affect the performance of the system. Also on ITS disks there is a processing “ Launching Routine Jobs”, Which forcibly launches scheduled jobs at the user's choice. The form of this processing is as follows:

So everyone preparatory work completed and you can proceed directly to the data search itself.

To start working with full-text search, you need to run the following command: menu Service à Data Search.

Then the following window will appear:

By pressing the button Settings, a field will appear with additional settings, such as: Limiting the search scope, Fuzziness, Serving Size(in this case, the value = 5, which means the output of five search results per page). Parameter Fuzziness denotes a mismatch of part of the characters in the search query and information obtained during the search. Fuzziness set as a percentage.

Full text search can use the following operators:

In addition, the full-text search mechanism allows writing part of the characters of the Russian word with single-key Latin characters. This will not change the search result.

In the client-server version, the task scheduler is responsible for scheduling the execution of tasks.

Task Scheduler is an active component of the server, i.e. regardless of the presence of client connections to the server, it can perform scheduled tasks. The activity of the scheduler is especially noticeable when it sequentially polls all infobases for the presence of scheduled tasks in them. The scheduler can postpone polling for a specific infobase if a connection lock or scheduled job blocking is imposed on the infobase.

The current list of scheduled tasks in the scheduler can be automatically changed (for example, when a new scheduled task is created or an existing scheduled task is deleted). In any case, the task mechanism ensures the relevance of the list of scheduled scheduler tasks and its compliance with the lists of scheduled tasks of the cluster infobases.

After initial list scheduled jobs have been successfully received, the scheduler periodically checks to see if there are requests for background jobs and if any scheduled jobs need to be executed according to their schedule. After the task is received by the workflow, the workflow establishes a connection to the infobase and executes the task within this connection. Since the workflow is optimized for multi-user work, only creating an infobase connection for the first time is a costly operation. Establishing subsequent connections to the same infobase takes significantly less time and resources, since most of the internal data structures are shared between the connections of the same infobase. After the job completes, the workflow notifies the scheduler of the success or failure of the job. In the event of a software failure, the scheduler can restart a scheduled task (if a failure occurred while executing a background task, it will not be restarted).

Thanks!

The functionality of the new search is based on two mechanisms:
- full-text search (works very quickly and requires a minimum of computing resources);
- search by means of a DBMS (in the general case, the duration of the search and the cost of computing resources are proportional to the amount of information in the table).

In the current implementation, the list will be searched without use full-text search in the following cases ():
- the full-text index is disabled at the infobase level;
- the object of the main table is not indexed by the full-text index;
- as a result of searching with full-text search, an error was received.

If full-text search is included in the infobase, and the index has not been updated in whole or in part (from my practice, 95% of the infobases of the Customers), then the user will receive either an invalid or an empty search result when searching.

We ask 1C Firm - what to do? how to guarantee the validity of search results always?
We get the answer: Yes, in order for the search results to be up-to-date with full-text search enabled, you need to ensure that the full-text search index is up-to-date. There are no other effective and relevant search options yet. ().

Is there a "current full-text index" at all? Depends on the number of users, the intensity of changes in the information in the database and the frequency of starting the index update. Typically, an index update is triggered every 60 seconds. It's good if not a lot of objects were changed, and the procedure managed to process all the changes in these 60 seconds. And if you made a re-posting of a group of documents, or a massive rewrite of a directory? In this case, no one can guarantee the time after which the index search will again return valid data.
In principle, this is not particularly critical, except in a few situations. A common option for users to work is to set a filter in the list by some value, for example, "Counterparty", enter a new document or copy an existing document and write it down. With the old search new document was instantly visible on the list. Now the user will see it only after N seconds in best case, where N is closer to 50-60 seconds rather than 2-3.
If you do not notice that there is no new document and according to the selected results provide information to someone, then it will be deliberately unreliable.

This was the case normal work with an information base. What will happen in specific situations? Here are a couple of examples.
1) B working base full-text index is included and updated frequently. The user asks to deploy a copy of the working database to him in order to analyze the data on it.
We restore the backup and give access. However, full-text search will not work. the index is stored not in the DBMS, but in separate files (both in the file and in the client-server version). There is no index in the dt file.
those. for the user to be able to use the search in the lists, the full-text index in this database must be turned off. True, the user will be slightly surprised that the search will take much longer. Or rebuild the index across the entire database.

2) (Relevant for more or less large bases). In a production database, the full-text index is enabled and updated frequently. The end of the month comes and the closing of the period begins. We begin to massively load and re-send documents. To reduce the load on the system, we block the execution of scheduled tasks, respectively, and the index update is stopped. Users will be, to put it mildly, at a loss - why are there no new or changed documents in the lists? The only way out is to disable full-text search for the infobase, and, accordingly, to get even more load on the equipment due to the heavy search for all requisites.

Thus, it seems to me that the operation of updating the index will become another headache for infobase administrators.
The system, which previously guaranteed 100% accuracy and relevance of information at any time, is now turning into a help system, in which one cannot be completely sure.
And users get one more reason to reproach IT-schnick - "your system is not working properly."