← All posts

FreeBSD. Installing and Configuring Yandex.Server

yandex-server

Let’s start with the fact that you need to choose the right version of this server, because otherwise it could end badly. That’s because one of the versions is an absolute nightmare, a port from Linux that doesn’t build properly, and that version is called FREE.

There are actually two versions: ENT and FREE. The first, as you’ve guessed, is enterprise, and the second is free.

The thing is, FREE recently disappeared from the Yandex technologies and products pages, and ENT began being distributed free of charge, although perhaps it was free before too and I simply hadn’t noticed.

Distribution terms Yandex.Server is distributed free of charge.

See the list of features and requirements here. More detailed documentation is available here.

Installation

Download the version for your architecture and install it by extracting the archive into the system root.

Configuring the Search Server

Edit the file /usr/local/etc/yandex/yandex.cfg


<Server>
  Port  17000
  Host example.com
  ServerLog     /var/local/yandex/yandex.log
  WorkDir  /var/local/yandex

  <Authorization>
    UserName            admin
    UserPassword        R#T$56YS
  </Authorization>
</Server>

<Collection autostart="yes">

  IndexDir /var/local/yandex/workindex

  <IndexLog>
      FileName       /var/local/yandex/index.log
      Level verbose moreinfo info debug moredebug
  </IndexLog>

  <DocFormat>
     MimeType application/pdf
  </DocFormat>

  <DataSrc id="webds">
    # название проекта
    Name exmaple

    # указываем с какого адреса надо начинать индексировать
    Config -w example.com
  </DataSrc>

</Collection>

Configuring the Indexer

Edit the file /usr/local/etc/yandex/dsindexer.cfg



<Collection>

    WorkDir     /var/local/yandex/
    IndexDir    /var/local/yandex/workindex
    TempDir     /var/local/yandex/newindex

    <DocFormat>
      MimeType  text/html
    </DocFormat>

    <DocFormat>
      Extensions        .txt
      MimeType  text/plain
    </DocFormat>

    <DataSrc id="webds">
      # название проекта
      Name exmaple

      # указываем с какого адреса надо начинать индексирование
      Config -w example.com
    </DataSrc>

    <IndexLog>
        Level           info
    </IndexLog>

</Collection>

Trying It Out

Restart Yandex.Server


# /usr/local/etc/rc.d/yandex.sh restart

Then go to http://example.com:17000/admin/,. If the server is running, the administration page will open; enter the username and password you specified in the “Authorization” section of yandex.cfg.

Now start indexing!


# dsindexer

Once the indexer finishes, it will tell you how many documents it has indexed, and new files should appear in the /var/local/yandex/newindex/ and /var/local/yandex/workindex/ directories, or their dates and sizes should change.

Now go to http://example.com:17000/ and try searching for something on your site :)

Styling the Search Results

Next, if you want to change the appearance of the search results, there are 2 options:

  1. Use XML output and display it however you like
  2. Edit the Perl/C++ templates included in the system

I’m interested in option 1, so we’ll be working with XML. It’s very simple: add xml=yes to the query string and then parse the results. That’s all!

http://example.com:17000/?text=test&xml=yes

Happy indexing! :)

Comments are closed. Read the original discussion in Russian →